https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103260
--- Comment #2 from kargl at gcc dot gnu.org --- Not sure why Martin tagged me of this problem. I definitely did not cause it as I don't insert assert()'s into code I write. Anywho, diff --git a/gcc/fortran/simplify.c b/gcc/fortran/simplify.c index d675f2c3aef..6b7a8eba063 100644 --- a/gcc/fortran/simplify.c +++ b/gcc/fortran/simplify.c @@ -6823,6 +6823,10 @@ gfc_simplify_reshape (gfc_expr *source, gfc_expr *shape_exp, if (source->shape == NULL) return NULL; + if (gfc_is_size_zero_array (source) + || gfc_is_size_zero_array (shape_exp)) + return NULL; + /* Proceed with simplification, unpacking the array. */ mpz_init (index);