aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/trans-expr.cc
diff options
context:
space:
mode:
authorHarald Anlauf <anlauf@gmx.de>2023-07-16 22:17:27 +0200
committerHarald Anlauf <anlauf@gmx.de>2023-07-17 20:23:06 +0200
commit95ddd2659849a904509067ec3a2770135149a722 (patch)
tree4f342c5545969db217ce7e618a3b8d163a25e4df /gcc/fortran/trans-expr.cc
parentcaabf0973a4e9a26421c94d540e3e20051e93e77 (diff)
downloadgcc-95ddd2659849a904509067ec3a2770135149a722.zip
gcc-95ddd2659849a904509067ec3a2770135149a722.tar.gz
gcc-95ddd2659849a904509067ec3a2770135149a722.tar.bz2
Fortran: intrinsics and deferred-length character arguments [PR95947,PR110658]
gcc/fortran/ChangeLog: PR fortran/95947 PR fortran/110658 * trans-expr.cc (gfc_conv_procedure_call): For intrinsic procedures whose result characteristics depends on the first argument and which can be of type character, the character length will not be deferred. gcc/testsuite/ChangeLog: PR fortran/95947 PR fortran/110658 * gfortran.dg/deferred_character_37.f90: New test.
Diffstat (limited to 'gcc/fortran/trans-expr.cc')
-rw-r--r--gcc/fortran/trans-expr.cc7
1 files changed, 6 insertions, 1 deletions
diff --git a/gcc/fortran/trans-expr.cc b/gcc/fortran/trans-expr.cc
index 8258543..ef3e6d0 100644
--- a/gcc/fortran/trans-expr.cc
+++ b/gcc/fortran/trans-expr.cc
@@ -7657,7 +7657,12 @@ gfc_conv_procedure_call (gfc_se * se, gfc_symbol * sym,
(and other intrinsics?) and dummy functions. In the case of SPREAD,
we take the character length of the first argument for the result.
For dummies, we have to look through the formal argument list for
- this function and use the character length found there.*/
+ this function and use the character length found there.
+ Likewise, we handle the case of deferred-length character dummy
+ arguments to intrinsics that determine the characteristics of
+ the result, which cannot be deferred-length. */
+ if (expr->value.function.isym)
+ ts.deferred = false;
if (ts.deferred)
cl.backend_decl = gfc_create_var (gfc_charlen_type_node, "slen");
else if (!sym->attr.dummy)