]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
backport: re PR fortran/90937 (ICE: in gfc_get_symbol_decl, at fortran/trans-decl...
authorThomas Koenig <tkoenig@gcc.gnu.org>
Fri, 21 Jun 2019 19:32:23 +0000 (19:32 +0000)
committerThomas Koenig <tkoenig@gcc.gnu.org>
Fri, 21 Jun 2019 19:32:23 +0000 (19:32 +0000)
2019-06-21  Thomas Koenig  <tkoenig@gcc.gnu.org>

Backport from trunk
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-21  Thomas Koenig  <tkoenig@gcc.gnu.org>

Backport from trunk
PR fortran/90937
* gfortran.dg/external_procedure_4.f90: New test.

From-SVN: r272566

gcc/fortran/ChangeLog
gcc/fortran/trans-types.c
gcc/testsuite/ChangeLog

index a6b01fc9cfd21920ff203a66d6b18196c941f0e7..e1549c697b3cee04da201568aa992fba8c0ac184 100644 (file)
@@ -1,3 +1,11 @@
+2019-06-21  Thomas Koenig  <tkoenig@gcc.gnu.org>
+
+       Backport from trunk
+       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-12  Thomas Koenig  <tkoenig@gcc.gnu.org>
        Tomáš Trnka  <trnka@scm.com>
 
index a010cf85d3001dac85bff4031b7d0a358bfc9762..0b82ceadff3541640c9b9a8a9272b368771cf224 100644 (file)
@@ -2924,7 +2924,7 @@ get_formal_from_actual_arglist (gfc_symbol *sym, gfc_actual_arglist *actual_args
       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;
@@ -2932,6 +2932,13 @@ get_formal_from_actual_arglist (gfc_symbol *sym, gfc_actual_arglist *actual_args
          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;
              s->attr.flavor = FL_VARIABLE;
              if (a->expr->rank > 0)
                {
index 95af0af8f3a4ed3e653b90adbe2a1eb9c2ad0867..2536a6f531783fc472eaa18b0f9a0d109dbe1c52 100644 (file)
@@ -1,3 +1,9 @@
+2019-06-21  Thomas Koenig  <tkoenig@gcc.gnu.org>
+
+       Backport from trunk
+       PR fortran/90937
+       * gfortran.dg/external_procedure_4.f90: New test.
+
 2019-06-13  Thomas Koenig  <tkoenig@gcc.gnu.org>
 
        PR fortran/90870