public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-4511] Fortran: Fix 'fn spec' for deferred character length
@ 2021-10-19 14:44 Tobias Burnus
  0 siblings, 0 replies; only message in thread
From: Tobias Burnus @ 2021-10-19 14:44 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:ff0eec94e87dfb7dc387f120ca5ade2707aecf50

commit r12-4511-gff0eec94e87dfb7dc387f120ca5ade2707aecf50
Author: Tobias Burnus <tobias@codesourcery.com>
Date:   Tue Oct 19 16:38:56 2021 +0200

    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.

Diff:
---
 gcc/fortran/trans-types.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/gcc/fortran/trans-types.c b/gcc/fortran/trans-types.c
index 50fceebc941..42778067dbe 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++] = ' ';
 	}
     }


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-10-19 14:44 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-19 14:44 [gcc r12-4511] Fortran: Fix 'fn spec' for deferred character length Tobias Burnus

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).