aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran
diff options
context:
space:
mode:
authorHarald Anlauf <anlauf@gmx.de>2023-07-27 21:30:26 +0200
committerHarald Anlauf <anlauf@gmx.de>2023-07-28 20:40:07 +0200
commit02f4ca0df2d69b922a622e7cc9b396cf686d5a0f (patch)
tree27afa7967ef3aff5aa81ef48ff78f85fbc4c260c /gcc/fortran
parent88618fa0211d77d91b70f7af9b02e08a34b57912 (diff)
downloadgcc-02f4ca0df2d69b922a622e7cc9b396cf686d5a0f.zip
gcc-02f4ca0df2d69b922a622e7cc9b396cf686d5a0f.tar.gz
gcc-02f4ca0df2d69b922a622e7cc9b396cf686d5a0f.tar.bz2
Fortran: do not pass hidden character length for TYPE(*) dummy [PR110825]
gcc/fortran/ChangeLog: PR fortran/110825 * gfortran.texi: Clarify argument passing convention. * trans-expr.cc (gfc_conv_procedure_call): Do not pass the character length as hidden argument when the declared dummy argument is assumed-type. gcc/testsuite/ChangeLog: PR fortran/110825 * gfortran.dg/assumed_type_18.f90: New test.
Diffstat (limited to 'gcc/fortran')
-rw-r--r--gcc/fortran/gfortran.texi3
-rw-r--r--gcc/fortran/trans-expr.cc1
2 files changed, 3 insertions, 1 deletions
diff --git a/gcc/fortran/gfortran.texi b/gcc/fortran/gfortran.texi
index 7786d23..f476a37 100644
--- a/gcc/fortran/gfortran.texi
+++ b/gcc/fortran/gfortran.texi
@@ -3750,7 +3750,8 @@ front ends of GCC, e.g. to GCC's C99 compiler for @code{_Bool}
or GCC's Ada compiler for @code{Boolean}.)
For arguments of @code{CHARACTER} type, the character length is passed
-as a hidden argument at the end of the argument list. For
+as a hidden argument at the end of the argument list, except when the
+corresponding dummy argument is declared as @code{TYPE(*)}. For
deferred-length strings, the value is passed by reference, otherwise
by value. The character length has the C type @code{size_t} (or
@code{INTEGER(kind=C_SIZE_T)} in Fortran). Note that this is
diff --git a/gcc/fortran/trans-expr.cc b/gcc/fortran/trans-expr.cc
index ef3e6d0..76456547 100644
--- a/gcc/fortran/trans-expr.cc
+++ b/gcc/fortran/trans-expr.cc
@@ -7521,6 +7521,7 @@ gfc_conv_procedure_call (gfc_se * se, gfc_symbol * sym,
&& !(fsym && fsym->ts.type == BT_DERIVED && fsym->ts.u.derived
&& fsym->ts.u.derived->intmod_sym_id == ISOCBINDING_PTR
&& fsym->ts.u.derived->from_intmod == INTMOD_ISO_C_BINDING )
+ && !(fsym && fsym->ts.type == BT_ASSUMED)
&& !(fsym && UNLIMITED_POLY (fsym)))
vec_safe_push (stringargs, parmse.string_length);