https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104332
kargl at gcc dot gnu.org changed: What |Removed |Added ---------------------------------------------------------------------------- Ever confirmed|0 |1 Status|UNCONFIRMED |NEW Last reconfirmed| |2022-02-01 --- Comment #3 from kargl at gcc dot gnu.org --- (In reply to G. Steinmetz from comment #0) > Affects versions down to r8 (ifort/ifx rejects it) : > > > $ cat z1.f90 > block data > bind(c) a > end > This fixes the ICE by avoiding a NULL pointer dereference. diff --git a/gcc/fortran/resolve.cc b/gcc/fortran/resolve.cc index 835a4783718..0ea68c707a0 100644 --- a/gcc/fortran/resolve.cc +++ b/gcc/fortran/resolve.cc @@ -15812,8 +15815,9 @@ resolve_symbol (gfc_symbol *sym) /* First, make sure the variable is declared at the module-level scope (J3/04-007, Section 15.3). */ - if (sym->ns->proc_name->attr.flavor != FL_MODULE && - sym->attr.in_common == 0) + if (sym->ns->proc_name + && sym->ns->proc_name->attr.flavor != FL_MODULE + && sym->attr.in_common == 0) { gfc_error ("Variable %qs at %L cannot be BIND(C) because it " "is neither a COMMON block nor declared at the "