diff options
author | Tobias Burnus <tobias@codesourcery.com> | 2021-10-19 16:38:56 +0200 |
---|---|---|
committer | Tobias Burnus <tobias@codesourcery.com> | 2021-10-19 16:43:56 +0200 |
commit | ff0eec94e87dfb7dc387f120ca5ade2707aecf50 (patch) | |
tree | a3ca049e6530d7e7834eca314a4a55199dfe704b | |
parent | 7ef0cc444488e0bfa9b63d46307105e78ffc17a6 (diff) | |
download | gcc-ff0eec94e87dfb7dc387f120ca5ade2707aecf50.zip gcc-ff0eec94e87dfb7dc387f120ca5ade2707aecf50.tar.gz gcc-ff0eec94e87dfb7dc387f120ca5ade2707aecf50.tar.bz2 |
Fortran: Fix 'fn spec' for deferred character length
Shows now up with gfortran.dg/deferred_type_param_6.f90 due to more ME
optimizations, causing fails without this commit.
gcc/fortran/ChangeLog:
* trans-types.c (create_fn_spec): For allocatable/pointer
character(len=:), use 'w' not 'R' as fn spec for the length dummy
argument.
-rw-r--r-- | gcc/fortran/trans-types.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/gcc/fortran/trans-types.c b/gcc/fortran/trans-types.c index 50fceeb..4277806 100644 --- a/gcc/fortran/trans-types.c +++ b/gcc/fortran/trans-types.c @@ -3014,7 +3014,11 @@ create_fn_spec (gfc_symbol *sym, tree fntype) } if (sym->ts.type == BT_CHARACTER) { - spec[spec_len++] = 'R'; + if (!sym->ts.u.cl->length + && (sym->attr.allocatable || sym->attr.pointer)) + spec[spec_len++] = 'w'; + else + spec[spec_len++] = 'R'; spec[spec_len++] = ' '; } } |