===================================================================
@@ -5163,6 +5163,9 @@
|| !is_constant_array_expr (order_exp))
return NULL;
+ if (source->shape == NULL)
+ return NULL;
+
/* Proceed with simplification, unpacking the array. */
mpz_init (index);
Proposed testcase:
===================================================================
@@ -0,0 +1,8 @@
+! { dg-do compile }
+! PR fortran/68566 - ICE on using unusable array in reshape
+! Testcase by Gerhard Steinmetz <gerhard.steinmetz.fortran at t-online.de>
+
+program p
+ integer, parameter :: a(:) = 1 ! { dg-error "or of deferred
shape" }
+ integer, parameter :: b(2,2) = reshape([a], [2,2])