------- Comment #3 from janus at gcc dot gnu dot org 2009-05-11 09:55 ------- Actually gfortran even has the same check as NAG that rejects a private type as component of a public type with -std=f95. And it happens that the bug which leads to the bogus error message lies just in this check. Thus the fix is easy:
Index: gcc/fortran/resolve.c =================================================================== --- gcc/fortran/resolve.c (revision 147349) +++ gcc/fortran/resolve.c (working copy) @@ -9088,11 +9088,11 @@ resolve_fl_derived (gfc_symbol *sym) && !gfc_check_access (c->ts.derived->attr.access, c->ts.derived->ns->default_access)) { - gfc_notify_std (GFC_STD_F2003, "Fortran 2003: the component '%s' " + if (gfc_notify_std (GFC_STD_F2003, "Fortran 2003: the component '%s' " "is a PRIVATE type and cannot be a component of " "'%s', which is PUBLIC at %L", c->name, - sym->name, &sym->declared_at); - return FAILURE; + sym->name, &sym->declared_at) == FAILURE) + return FAILURE; } if (sym->attr.sequence) -- janus at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- AssignedTo|unassigned at gcc dot gnu |janus at gcc dot gnu dot org |dot org | Status|UNCONFIRMED |ASSIGNED Ever Confirmed|0 |1 Last reconfirmed|0000-00-00 00:00:00 |2009-05-11 09:55:35 date| | http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40089