https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95880
anlauf at gcc dot gnu.org changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |anlauf at gcc dot gnu.org --- Comment #4 from anlauf at gcc dot gnu.org --- (In reply to Martin Liška from comment #3) > Started with r11-524-geb069ae8819c3a84. Good catch. Fix: diff --git a/gcc/fortran/symbol.c b/gcc/fortran/symbol.c index ba388ff598d..bfec57ccd9e 100644 --- a/gcc/fortran/symbol.c +++ b/gcc/fortran/symbol.c @@ -2027,7 +2027,12 @@ gfc_add_type (gfc_symbol *sym, gfc_typespec *ts, locus *where) || (flavor == FL_PROCEDURE && sym->attr.subroutine) || flavor == FL_DERIVED || flavor == FL_NAMELIST) { - gfc_error ("Symbol %qs at %L cannot have a type", sym->ns->proc_name->name, where); + if (sym->ns->proc_name) + gfc_error ("Symbol %qs at %L cannot have a type", + sym->ns->proc_name->name, where); + else + gfc_error ("Symbol %qs at %L cannot have a type", + sym->name, where); return false; } Regtesting.