diff mbox series

[committed] Fix for PR 90937

Message ID c990fb34-1086-c651-f72f-175008c99b9f@netcologne.de
State New
Headers show
Series [committed] Fix for PR 90937 | expand

Commit Message

Thomas Koenig June 20, 2019, 12:03 p.m. UTC
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  <tkoenig@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  <tkoenig@gcc.gnu.org>

	PR fortran/90937
	* gfortran.dg/external_procedure_4.f90: New test.
diff mbox series

Patch

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;