http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46244
Summary: gfc_compare_derived_types is buggy Product: gcc Version: 4.6.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran AssignedTo: unassig...@gcc.gnu.org ReportedBy: ja...@gcc.gnu.org As noted by Dominique in PR 46196 comment #5, there is a problem in gfc_compare_derived_types (interface.c): --- ../_clean/gcc/fortran/interface.c 2010-10-27 23:47:20.000000000 +0200 +++ gcc/fortran/interface.c 2010-10-29 10:55:07.000000000 +0200 @@ -445,16 +445,16 @@ gfc_compare_derived_types (gfc_symbol *d /* Make sure that link lists do not put this function into an endless recursive loop! */ if (!(dt1->ts.type == BT_DERIVED && derived1 == dt1->ts.u.derived) - && !(dt1->ts.type == BT_DERIVED && derived1 == dt1->ts.u.derived) + && !(dt2->ts.type == BT_DERIVED && derived2 == dt2->ts.u.derived) && gfc_compare_types (&dt1->ts, &dt2->ts) == 0) return 0; else if ((dt1->ts.type == BT_DERIVED && derived1 == dt1->ts.u.derived) - && !(dt1->ts.type == BT_DERIVED && derived1 == dt1->ts.u.derived)) + && !(dt2->ts.type == BT_DERIVED && derived2 == dt2->ts.u.derived)) return 0; else if (!(dt1->ts.type == BT_DERIVED && derived1 == dt1->ts.u.derived) - && (dt1->ts.type == BT_DERIVED && derived1 == dt1->ts.u.derived)) + && (dt2->ts.type == BT_DERIVED && derived2 == dt2->ts.u.derived)) return 0; dt1 = dt1->next;