https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89496

--- Comment #2 from Thomas Koenig <tkoenig at gcc dot gnu.org> ---
This looks pretty obvious to me, at least looking at the
-fdump-fortran-original dump.  I will try to come up with
a test case.

Would it be possible to check that this also fixes the
nullpointer offset access?

Index: trans-types.c
===================================================================
--- trans-types.c       (Revision 269161)
+++ trans-types.c       (Arbeitskopie)
@@ -2988,9 +2988,9 @@
   f = &sym->formal;
   for (a = actual_args; a != NULL; a = a->next)
     {
+      (*f) = gfc_get_formal_arglist ();
       if (a->expr)
        {
-         (*f) = gfc_get_formal_arglist ();
          snprintf (name, GFC_MAX_SYMBOL_LEN, "_formal_%d", var_num ++);
          gfc_get_symbol (name, NULL, &s);
          if (a->expr->ts.type == BT_PROCEDURE)
@@ -3012,6 +3012,9 @@
          s->attr.intent = INTENT_UNKNOWN;
          (*f)->sym = s;
        }
+      else
+       (*f)->sym = NULL;
+
       f = &((*f)->next);
     }
 }

Reply via email to