aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/interface.c
diff options
context:
space:
mode:
authorPaul Thomas <pault@gcc.gnu.org>2007-12-31 18:05:10 +0000
committerPaul Thomas <pault@gcc.gnu.org>2007-12-31 18:05:10 +0000
commit63287e10a8527f9ed9d7c3939943ab1bc66aa46b (patch)
treedaf721ae8c46819c335ccc6f7647203507b90390 /gcc/fortran/interface.c
parent881466d851f3c806692bda4569a4534d89848104 (diff)
downloadgcc-63287e10a8527f9ed9d7c3939943ab1bc66aa46b.zip
gcc-63287e10a8527f9ed9d7c3939943ab1bc66aa46b.tar.gz
gcc-63287e10a8527f9ed9d7c3939943ab1bc66aa46b.tar.bz2
re PR fortran/34558 (ICE with same TYPE in both program and interface)
2007-12-31 Paul Thomas <pault@gcc.gnu.org> 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 <pault@gcc.gnu.org> PR fortran/34558 * gfortran.dg/linked_list_1.f90: New test. From-SVN: r131238
Diffstat (limited to 'gcc/fortran/interface.c')
-rw-r--r--gcc/fortran/interface.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/gcc/fortran/interface.c b/gcc/fortran/interface.c
index b242d07..717f3b7 100644
--- a/gcc/fortran/interface.c
+++ b/gcc/fortran/interface.c
@@ -407,7 +407,17 @@ gfc_compare_derived_types (gfc_symbol *derived1, gfc_symbol *derived2)
if (dt1->dimension && gfc_compare_array_spec (dt1->as, dt2->as) == 0)
return 0;
- if (gfc_compare_types (&dt1->ts, &dt2->ts) == 0)
+ /* Make sure that link lists do not put this function in an
+ endless 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)
return 0;
dt1 = dt1->next;