gcc/fortran/ChangeLog:
PR fortran/103694
* simplify.cc (simplify_size): The size expression of an array cannot
be simplified if an error occurs while resolving the array spec.
gcc/testsuite/ChangeLog:
PR fortran/103694
* gfortran.dg/pr103694.f90: New test.
(cherry picked from commit
55d8c5409325001c89c35c3d04d425dec9127146)
}
for (ref = array->ref; ref; ref = ref->next)
- if (ref->type == REF_ARRAY && ref->u.ar.as)
- gfc_resolve_array_spec (ref->u.ar.as, 0);
+ if (ref->type == REF_ARRAY && ref->u.ar.as
+ && !gfc_resolve_array_spec (ref->u.ar.as, 0))
+ return NULL;
if (dim == NULL)
{
--- /dev/null
+! { dg-do compile }
+! PR fortran/103694 - ICE in gfc_conv_expr_op
+! Contributed by G.Steinmetz
+
+subroutine s
+ type t
+ integer :: a(2)
+ end type
+ type(t) :: x((0.)/0)
+ integer :: n = size(x(1)%a) ! { dg-error "does not reduce to a constant expression" }
+end