http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46344
--- Comment #9 from janus at gcc dot gnu.org 2010-11-07 21:12:22 UTC --- (In reply to comment #8) > The ICE can be fixed with the following patch: Here is a better patch which has the same effect: Index: gcc/fortran/trans-types.c =================================================================== --- gcc/fortran/trans-types.c (revision 166419) +++ gcc/fortran/trans-types.c (working copy) @@ -1936,10 +1936,12 @@ gfc_copy_dt_decls_ifequal (gfc_symbol *from, gfc_s for (; to_cm; to_cm = to_cm->next, from_cm = from_cm->next) { to_cm->backend_decl = from_cm->backend_decl; - if ((!from_cm->attr.pointer || from_gsym) - && from_cm->ts.type == BT_DERIVED) + if (from_cm->ts.type == BT_DERIVED + && (!from_cm->attr.pointer || from_gsym)) gfc_get_derived_type (to_cm->ts.u.derived); - + else if (from_cm->ts.type == BT_CLASS + && (!CLASS_DATA (from_cm)->attr.class_pointer || from_gsym)) + gfc_get_derived_type (to_cm->ts.u.derived); else if (from_cm->ts.type == BT_CHARACTER) to_cm->ts.u.cl->backend_decl = from_cm->ts.u.cl->backend_decl; } In fact this one pretty much qualifies as obvious, once the location of the problem has been identified. It's one of those instances where we do something for BT_DERIVED, but fail to do the analogous thing for BT_CLASS. I will commit after regtesting.