Fortran: error recovery on associate with bad selector [PR107577]
gcc/fortran/ChangeLog: PR fortran/107577 * resolve.cc (find_array_spec): Choose appropriate locus either of bad array reference or of non-array entity in error message. gcc/testsuite/ChangeLog: PR fortran/107577 * gfortran.dg/pr107577.f90: New test.
This commit is contained in:
parent
8a0fce6a51
commit
2eaa0cc45e
2 changed files with 15 additions and 1 deletions
|
@ -5005,8 +5005,9 @@ find_array_spec (gfc_expr *e)
|
|||
case REF_ARRAY:
|
||||
if (as == NULL)
|
||||
{
|
||||
locus loc = ref->u.ar.where.lb ? ref->u.ar.where : e->where;
|
||||
gfc_error ("Invalid array reference of a non-array entity at %L",
|
||||
&ref->u.ar.where);
|
||||
&loc);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
13
gcc/testsuite/gfortran.dg/pr107577.f90
Normal file
13
gcc/testsuite/gfortran.dg/pr107577.f90
Normal file
|
@ -0,0 +1,13 @@
|
|||
! { dg-do compile }
|
||||
! PR fortran/107577 - ICE in find_array_spec
|
||||
! Contributed by G.Steinmetz
|
||||
|
||||
program p
|
||||
implicit none
|
||||
associate (y => f(4)) ! { dg-error "has no IMPLICIT type" }
|
||||
if (lbound (y, 1) /= 1) stop 1 ! { dg-error "Invalid array reference" }
|
||||
if (y(1) /= 1) stop 2 ! { dg-error "Invalid array reference" }
|
||||
end associate
|
||||
end
|
||||
|
||||
! { dg-error "has no type" " " { target *-*-* } 7 }
|
Loading…
Add table
Reference in a new issue