aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc')
-rw-r--r--gcc/fortran/resolve.cc3
-rw-r--r--gcc/testsuite/gfortran.dg/pr107577.f9013
2 files changed, 15 insertions, 1 deletions
diff --git a/gcc/fortran/resolve.cc b/gcc/fortran/resolve.cc
index 24e5aa0..3396c6c 100644
--- a/gcc/fortran/resolve.cc
+++ b/gcc/fortran/resolve.cc
@@ -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;
}
diff --git a/gcc/testsuite/gfortran.dg/pr107577.f90 b/gcc/testsuite/gfortran.dg/pr107577.f90
new file mode 100644
index 0000000..94e6620
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pr107577.f90
@@ -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 }