diff options
author | Tobias Burnus <tburnus@baylibre.com> | 2025-01-16 11:50:26 +0100 |
---|---|---|
committer | Tobias Burnus <tburnus@baylibre.com> | 2025-01-16 11:50:26 +0100 |
commit | c5a8e22c5dacf4f9d4f66e60990bf34c70f04714 (patch) | |
tree | 7dc4ee304c4039cd8f958fe3643bbfc3e8189a04 /gcc/fortran/trans-intrinsic.cc | |
parent | 462a7f45caf78466ee6d9a1256a1e2848e4ec49c (diff) | |
download | gcc-c5a8e22c5dacf4f9d4f66e60990bf34c70f04714.zip gcc-c5a8e22c5dacf4f9d4f66e60990bf34c70f04714.tar.gz gcc-c5a8e22c5dacf4f9d4f66e60990bf34c70f04714.tar.bz2 |
Fortran: Create fresh ts.u.cl for result in gfc_get_symbol_for_expr [PR118441]
For intrinsic routines, called in libraries, the prototype is created from
the call via gfc_get_symbol_for_expr. For the actual arguments, it calls
gfc_copy_formal_args_intr which already ensures that the ts.u.cl is freshly
allocated.
This commit now ensures the same for character-returning functions.
PR fortran/118441
gcc/fortran/ChangeLog:
* trans-intrinsic.cc (gfc_get_symbol_for_expr): Use
gfc_new_charlen for character-returning functions.
gcc/testsuite/ChangeLog:
* gfortran.dg/gomp/intrinsic_pack_7.f90: New test.
Diffstat (limited to 'gcc/fortran/trans-intrinsic.cc')
-rw-r--r-- | gcc/fortran/trans-intrinsic.cc | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/gcc/fortran/trans-intrinsic.cc b/gcc/fortran/trans-intrinsic.cc index cc3a2e5..afbec5b 100644 --- a/gcc/fortran/trans-intrinsic.cc +++ b/gcc/fortran/trans-intrinsic.cc @@ -4242,6 +4242,8 @@ gfc_get_symbol_for_expr (gfc_expr * expr, bool ignore_optional) sym = gfc_new_symbol (expr->value.function.name, NULL); sym->ts = expr->ts; + if (sym->ts.type == BT_CHARACTER) + sym->ts.u.cl = gfc_new_charlen (gfc_current_ns, NULL); sym->attr.external = 1; sym->attr.function = 1; sym->attr.always_explicit = 1; |