https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93364
anlauf at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |anlauf at gcc dot gnu.org
--- Comment #2 from anlauf at gcc dot gnu.org ---
The following patch would avoid the ICE:
diff --git a/gcc/fortran/array.c b/gcc/fortran/array.c
index 57972bc9176..471523fb767 100644
--- a/gcc/fortran/array.c
+++ b/gcc/fortran/array.c
@@ -864,6 +864,10 @@ gfc_set_array_spec (gfc_symbol *sym, gfc_array_spec *as,
locus *error_loc)
return false;
}
+ /* Check F2018:C822. */
+ if (sym->as->rank + sym->as->corank > GFC_MAX_DIMENSIONS)
+ goto too_many;
+
if (as->corank)
{
sym->as->cotype = as->cotype;
I have a gut feeling that this kind of check should trigger earlier,
but cannot find this place.