https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103138
anlauf at gcc dot gnu.org changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |anlauf at gcc dot gnu.org Ever confirmed|0 |1 Last reconfirmed| |2021-11-08 Status|UNCONFIRMED |NEW --- Comment #1 from anlauf at gcc dot gnu.org --- Naive patch: diff --git a/gcc/fortran/simplify.c b/gcc/fortran/simplify.c index d675f2c3aef..6cce7703667 100644 --- a/gcc/fortran/simplify.c +++ b/gcc/fortran/simplify.c @@ -2109,6 +2109,9 @@ gfc_simplify_cshift (gfc_expr *array, gfc_expr *shift, gfc_expr *dim) else which = 0; + if (array->shape == NULL) + return NULL; + gfc_array_size (array, &size); arraysize = mpz_get_ui (size); mpz_clear (size); However, this leads to a bogus error for the testcase: pr103138.f90:5:31: 5 | integer, parameter :: b(2) = cshift(a, 1) | 1 Error: transformational intrinsic 'cshift' at (1) is not permitted in an initialization expression