gcc/fortran/ChangeLog:
PR fortran/103608
* frontend-passes.cc (do_intent): Catch NULL pointer dereference on
reference to invalid formal argument.
gcc/testsuite/ChangeLog:
PR fortran/103608
* gfortran.dg/pr103608.f90: New test.
do_sym = dl->ext.iterator->var->symtree->n.sym;
if (a->expr && a->expr->symtree
- && a->expr->symtree->n.sym == do_sym)
+ && a->expr->symtree->n.sym == do_sym
+ && f->sym)
{
if (f->sym->attr.intent == INTENT_OUT)
gfc_error_now ("Variable %qs at %L set to undefined value "
--- /dev/null
+! { dg-do compile }
+! { dg-options "-w" }
+! PR fortran/103608 - ICE in do_intent
+! Contributed by G.Steinmetz
+
+program p
+ implicit none
+ integer :: i
+ integer :: x ! { dg-error "Alternate return specifier" }
+ x(*) = 0
+ do i = 1, 2
+ print *, x(i) ! { dg-error "Missing alternate return specifier" }
+ end do
+end