https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66052
kargl at gcc dot gnu.org changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Last reconfirmed| |2015-05-07 CC| |kargl at gcc dot gnu.org Ever confirmed|0 |1 --- Comment #1 from kargl at gcc dot gnu.org --- Confirmed. This patch Index: decl.c =================================================================== --- decl.c (revision 222869) +++ decl.c (working copy) @@ -6968,7 +6968,8 @@ gfc_match_protected (void) gfc_symbol *sym; match m; - if (gfc_current_ns->proc_name->attr.flavor != FL_MODULE) + if (gfc_current_ns->proc_name && + gfc_current_ns->proc_name->attr.flavor != FL_MODULE) { gfc_error ("PROTECTED at %C only allowed in specification " "part of a module"); gives % gfc6 -c po.f90 po.f90:3:13: protected x 1 Error: Unexpected attribute declaration statement in CONTAINS section at (1)