https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68440
janus at gcc dot gnu.org changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|unassigned at gcc dot gnu.org |janus at gcc dot gnu.org --- Comment #4 from janus at gcc dot gnu.org --- Draft patch: Index: gcc/fortran/expr.c =================================================================== --- gcc/fortran/expr.c (Revision 241972) +++ gcc/fortran/expr.c (Arbeitskopie) @@ -2206,7 +2206,7 @@ check_alloc_comp_init (gfc_expr *e) gfc_constructor *ctor; gcc_assert (e->expr_type == EXPR_STRUCTURE); - gcc_assert (e->ts.type == BT_DERIVED); + gcc_assert (e->ts.type == BT_DERIVED || e->ts.type == BT_CLASS); for (comp = e->ts.u.derived->components, ctor = gfc_constructor_first (e->value.constructor); Index: gcc/fortran/resolve.c =================================================================== --- gcc/fortran/resolve.c (Revision 241972) +++ gcc/fortran/resolve.c (Arbeitskopie) @@ -14001,6 +14001,19 @@ resolve_fl_parameter (gfc_symbol *sym) &sym->value->where); return false; } + + /* F03:C509. */ + /* Assume that use associated symbols were checked in the module ns. + Class variables that are associate-names are also something special + and excepted from the test. */ + if (sym->ts.type == BT_CLASS && !sym->attr.class_ok + && !sym->attr.use_assoc && !sym->assoc) + { + gfc_error ("CLASS variable %qs at %L must be dummy, allocatable " + "or pointer", sym->name, &sym->declared_at); + return false; + } + return true; }