diff options
-rw-r--r-- | gcc/fortran/simplify.cc | 1 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/pr108529.f90 | 9 |
2 files changed, 10 insertions, 0 deletions
diff --git a/gcc/fortran/simplify.cc b/gcc/fortran/simplify.cc index f413f13..20ea38e 100644 --- a/gcc/fortran/simplify.cc +++ b/gcc/fortran/simplify.cc @@ -720,6 +720,7 @@ simplify_transformation (gfc_expr *array, gfc_expr *dim, gfc_expr *mask, size_zero = gfc_is_size_zero_array (array); if (!(is_constant_array_expr (array) || size_zero) + || array->shape == NULL || !gfc_is_constant_expr (dim)) return NULL; diff --git a/gcc/testsuite/gfortran.dg/pr108529.f90 b/gcc/testsuite/gfortran.dg/pr108529.f90 new file mode 100644 index 0000000..34c9691 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr108529.f90 @@ -0,0 +1,9 @@ +! { dg-do compile } +! PR fortran/108529 - ICE in transformational_result +! Contributed by G.Steinmetz + +program p + integer, parameter :: a(*,*) = reshape([1, 2, 3, 4], [2, 2]) + logical, parameter :: b(2,*) = a > 2 ! { dg-error "Assumed size" } + logical, parameter :: c(*) = all(b, 1) ! { dg-error "Bad shape" } +end |