diff options
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/fortran/simplify.cc | 5 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/pr103694.f90 | 11 |
2 files changed, 14 insertions, 2 deletions
diff --git a/gcc/fortran/simplify.cc b/gcc/fortran/simplify.cc index f992c31..bc178d5 100644 --- a/gcc/fortran/simplify.cc +++ b/gcc/fortran/simplify.cc @@ -7536,8 +7536,9 @@ simplify_size (gfc_expr *array, gfc_expr *dim, int k) } 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) { diff --git a/gcc/testsuite/gfortran.dg/pr103694.f90 b/gcc/testsuite/gfortran.dg/pr103694.f90 new file mode 100644 index 0000000..3ed8b20 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr103694.f90 @@ -0,0 +1,11 @@ +! { 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 |