https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89496
--- Comment #4 from Martin Liška <marxin at gcc dot gnu.org> ---
(In reply to Thomas Koenig from comment #2)
> 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);
> }
> }
I can confirm this works fine for the test-case as well as for
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89496#c3
Thanks for the fix.