https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103507
kargl at gcc dot gnu.org changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |kargl at gcc dot gnu.org --- Comment #2 from kargl at gcc dot gnu.org --- This patch prevents the ICE, but is not as elegant as I would like. diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c index f074a0ab3a1..08f657407da 100644 --- a/gcc/fortran/resolve.c +++ b/gcc/fortran/resolve.c @@ -17553,6 +17553,14 @@ gfc_resolve (gfc_namespace *ns) code_stack *old_cs_base; struct gfc_omp_saved_state old_omp_state; + if (!ns) + { + int ecnt; + gfc_get_errors (NULL, &ecnt); + if (ecnt > 0) + gfc_fatal_error ("Namespace corruption due to previous errors"); + } + if (ns->resolved) return; The problem seems to be with one of more namespaces being incomplete and/or overlapping.