http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54594
janus at gcc dot gnu.org changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |ASSIGNED AssignedTo|unassigned at gcc dot |janus at gcc dot gnu.org |gnu.org | --- Comment #4 from janus at gcc dot gnu.org 2012-09-15 21:02:17 UTC --- Apparently the problem is that gfc_compare_types does not handle CLASS arrays properly. The following patch should fix it (it makes gfortran accept the test case): Index: gcc/fortran/interface.c =================================================================== --- gcc/fortran/interface.c (revision 191303) +++ gcc/fortran/interface.c (working copy) @@ -507,14 +507,18 @@ gfc_compare_types (gfc_typespec *ts1, gfc_typespec static int compare_type_rank (gfc_symbol *s1, gfc_symbol *s2) { + gfc_array_spec *as1, *as2; int r1, r2; - r1 = (s1->as != NULL) ? s1->as->rank : 0; - r2 = (s2->as != NULL) ? s2->as->rank : 0; + as1 = (s1->ts.type == BT_CLASS) ? CLASS_DATA (s1)->as : s1->as; + as2 = (s2->ts.type == BT_CLASS) ? CLASS_DATA (s2)->as : s2->as; + r1 = as1 ? as1->rank : 0; + r2 = as2 ? as2->rank : 0; + if (r1 != r2 - && (!s1->as || s1->as->type != AS_ASSUMED_RANK) - && (!s2->as || s2->as->type != AS_ASSUMED_RANK)) + && (!as1 || as1->type != AS_ASSUMED_RANK) + && (!as2 || as2->type != AS_ASSUMED_RANK)) return 0; /* Ranks differ. */ return gfc_compare_types (&s1->ts, &s2->ts) Regtesting now ...