https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111218
--- Comment #7 from kargl at gcc dot gnu.org --- An alternative patch that allows the original code to compile is diff --git a/gcc/fortran/symbol.cc b/gcc/fortran/symbol.cc index a6078bc608a..34eb3a65e8f 100644 --- a/gcc/fortran/symbol.cc +++ b/gcc/fortran/symbol.cc @@ -3160,7 +3160,7 @@ static void ambiguous_symbol (const char *name, gfc_symtree *st) { - if (st->n.sym->error) + if (st->n.sym->error || (st->n.sym->module && !gfc_current_locus.lb)) return; if (st->n.sym->module) This one simply returns. If one actually tries to reference the conflicting entity an error message is generated.