https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103610
--- Comment #3 from anlauf at gcc dot gnu.org --- Tentative patch: diff --git a/gcc/fortran/array.c b/gcc/fortran/array.c index e5e22099405..a23fabbdcdb 100644 --- a/gcc/fortran/array.c +++ b/gcc/fortran/array.c @@ -2330,6 +2330,9 @@ spec_dimen_size (gfc_array_spec *as, int dimen, mpz_t *result) mpz_add_ui (*result, *result, 1); + if (mpz_cmp_si (*result, 0) < 0) + mpz_set_si (*result, 0); + return true; }