From: Paul Thomas Date: Mon, 31 Dec 2007 18:10:55 +0000 (+0000) Subject: re PR fortran/34558 (ICE with same TYPE in both program and interface) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=6669dbdf742219dc81ae087c51c6ddf771b13d3f;p=gcc.git re PR fortran/34558 (ICE with same TYPE in both program and interface) 2007-12-31 Paul Thomas PR fortran/34558 * interface.c (gfc_compare_types): Prevent linked lists from putting this function into an endless recursive loop. 2007-12-31 Paul Thomas PR fortran/34558 * gfortran.dg/linked_list_1.f90: New test. From-SVN: r131239 --- diff --git a/gcc/fortran/interface.c b/gcc/fortran/interface.c index 717f3b78258..519251efb2e 100644 --- a/gcc/fortran/interface.c +++ b/gcc/fortran/interface.c @@ -407,17 +407,19 @@ gfc_compare_derived_types (gfc_symbol *derived1, gfc_symbol *derived2) if (dt1->dimension && gfc_compare_array_spec (dt1->as, dt2->as) == 0) return 0; - /* Make sure that link lists do not put this function in an - endless loop! */ + /* Make sure that link lists do not put this function into an + endless recursive loop! */ if (!(dt1->ts.type == BT_DERIVED && derived1 == dt1->ts.derived) && !(dt1->ts.type == BT_DERIVED && derived1 == dt1->ts.derived) && gfc_compare_types (&dt1->ts, &dt2->ts) == 0) return 0; - else if (dt1->ts.type != BT_DERIVED - || derived1 != dt1->ts.derived - || dt2->ts.type != BT_DERIVED - || derived2 != dt2->ts.derived) + else if ((dt1->ts.type == BT_DERIVED && derived1 == dt1->ts.derived) + && !(dt1->ts.type == BT_DERIVED && derived1 == dt1->ts.derived)) + return 0; + + else if (!(dt1->ts.type == BT_DERIVED && derived1 == dt1->ts.derived) + && (dt1->ts.type == BT_DERIVED && derived1 == dt1->ts.derived)) return 0; dt1 = dt1->next;