http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55825
janus at gcc dot gnu.org changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Last reconfirmed| |2012-12-28 Ever Confirmed|0 |1 --- Comment #2 from janus at gcc dot gnu.org 2012-12-28 17:49:41 UTC --- Draft patch: Index: gcc/fortran/resolve.c =================================================================== --- gcc/fortran/resolve.c (revision 194743) +++ gcc/fortran/resolve.c (working copy) @@ -1089,7 +1089,10 @@ resolve_structure_cons (gfc_expr *expr, int init) continue; } - rank = comp->as ? comp->as->rank : 0; + if (comp->ts.type == BT_CLASS) + rank = CLASS_DATA (comp)->as ? CLASS_DATA (comp)->as->rank : 0; + else + rank = comp->as ? comp->as->rank : 0; if (cons->expr->expr_type != EXPR_NULL && rank != cons->expr->rank && (comp->attr.allocatable || cons->expr->rank)) { This gets me past the first error in comment 1, but does not fix the second one.