https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98458
kargl at gcc dot gnu.org changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |kargl at gcc dot gnu.org --- Comment #3 from kargl at gcc dot gnu.org --- Index: gcc/fortran/simplify.c =================================================================== --- gcc/fortran/simplify.c (revision 1050250) +++ gcc/fortran/simplify.c (working copy) @@ -6728,13 +6731,18 @@ gfc_simplify_reshape (gfc_expr *source, gfc_expr *shap bool zerosize = false; /* Check that argument expression types are OK. */ - if (!is_constant_array_expr (source) - || !is_constant_array_expr (shape_exp) - || !is_constant_array_expr (pad) - || !is_constant_array_expr (order_exp)) - return NULL; + if (!is_constant_array_expr (source)) + { + if (gfc_init_expr_flag && !gfc_reduce_init_expr (source)) + return NULL; + } if (source->shape == NULL) + return NULL; + + if (!is_constant_array_expr (shape_exp) + || !is_constant_array_expr (pad) + || !is_constant_array_expr (order_exp)) return NULL; /* Proceed with simplification, unpacking the array. */