Hello world,

I have committed the attached patch to trunk as obvious to fix another
of the regressions stemming from the "make up formal from actual
arglist" patch, as obvious and simple.

I will backport this patch to the other affected branches, probably
over the weekend.

Regards

        Thomas

2019-06-20  Thomas Koenig  <tkoe...@gcc.gnu.org>

        PR fortran/90937
        * trans-types.c (get_formal_from_actual_arglist): Get symbol from
        current namespace so it will be freed later.  If symbol is of type
        character, get an empty character length.

2019-06-20  Thomas Koenig  <tkoe...@gcc.gnu.org>

        PR fortran/90937
        * gfortran.dg/external_procedure_4.f90: New test.
Index: trans-types.c
===================================================================
--- trans-types.c	(Revision 272479)
+++ trans-types.c	(Arbeitskopie)
@@ -2997,7 +2997,7 @@ get_formal_from_actual_arglist (gfc_symbol *sym, g
       if (a->expr)
 	{
 	  snprintf (name, GFC_MAX_SYMBOL_LEN, "_formal_%d", var_num ++);
-	  gfc_get_symbol (name, NULL, &s);
+	  gfc_get_symbol (name, gfc_current_ns, &s);
 	  if (a->expr->ts.type == BT_PROCEDURE)
 	    {
 	      s->attr.flavor = FL_PROCEDURE;
@@ -3005,6 +3005,10 @@ get_formal_from_actual_arglist (gfc_symbol *sym, g
 	  else
 	    {
 	      s->ts = a->expr->ts;
+
+	      if (s->ts.type == BT_CHARACTER)
+		  s->ts.u.cl = gfc_get_charlen ();
+
 	      s->ts.deferred = 0;
 	      s->ts.is_iso_c = 0;
 	      s->ts.is_c_interop = 0;
! { dg-do compile }
! PR fortran/90937 - this used to cause an ICE.
! Original test case by Toon Moene.
subroutine lfidiff

   implicit none

   contains 

      subroutine grlfi(cdnom)

         character(len=*) cdnom(:)
         character(len=len(cdnom)) clnoma

         call lficas(clnoma)

      end subroutine grlfi

end subroutine lfidiff

Reply via email to