diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index bfc6d6db223..d758a484db4 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,9 @@ +2006-11-22 Paul Thomas + + PR fortran/29652 + * interface.c (check_interface1): Use a local value, instead of + the dummy, as the inner iterator over interface symbols. + 2006-11-21 Paul Thomas PR fortran/29820 diff --git a/gcc/fortran/interface.c b/gcc/fortran/interface.c index 5a9b2da7064..e1564b21e2e 100644 --- a/gcc/fortran/interface.c +++ b/gcc/fortran/interface.c @@ -964,12 +964,12 @@ check_interface0 (gfc_interface * p, const char *interface_name) here. */ static int -check_interface1 (gfc_interface * p, gfc_interface * q, +check_interface1 (gfc_interface * p, gfc_interface * q0, int generic_flag, const char *interface_name) { - + gfc_interface * q; for (; p; p = p->next) - for (; q; q = q->next) + for (q = q0; q; q = q->next) { if (p->sym == q->sym) continue; /* Duplicates OK here */ diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 58ed09da58b..564af554773 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2006-11-22 Paul Thomas + + PR fortran/29652 + * gfortran.dg/generic_7.f90: New test. + * gfortran.dg/defined_operators_1.f90: Add new error. + 2006-11-22 Zdenek Dvorak PR tree-optimization/29902 diff --git a/gcc/testsuite/gfortran.dg/defined_operators_1.f90 b/gcc/testsuite/gfortran.dg/defined_operators_1.f90 index c2369b2317c..0233bf0b9a7 100644 --- a/gcc/testsuite/gfortran.dg/defined_operators_1.f90 +++ b/gcc/testsuite/gfortran.dg/defined_operators_1.f90 @@ -11,7 +11,7 @@ module mymod module procedure foo_1 ! { dg-error "must be INTENT" } module procedure foo_2 ! { dg-error "cannot be optional" } module procedure foo_3 ! { dg-error "must have, at most, two arguments" } - module procedure foo_1_OK + module procedure foo_1_OK ! { dg-error "Ambiguous interfaces" } module procedure foo_2_OK function foo_chr (chr) ! { dg-error "cannot be assumed character length" } character(*) :: foo_chr diff --git a/gcc/testsuite/gfortran.dg/generic_7.f90 b/gcc/testsuite/gfortran.dg/generic_7.f90 new file mode 100644 index 00000000000..12cb9ae0dcf --- /dev/null +++ b/gcc/testsuite/gfortran.dg/generic_7.f90 @@ -0,0 +1,27 @@ +! { dg-do compile } +! Tests the fix for PR29652, in which ambiguous interfaces were not detected +! with more than two specific procedures in the interface. +! +! Contributed by Daniel Franke +! +MODULE global +INTERFACE iface + MODULE PROCEDURE sub_a + MODULE PROCEDURE sub_b ! { dg-error "Ambiguous interfaces" } + MODULE PROCEDURE sub_c +END INTERFACE +CONTAINS + SUBROUTINE sub_a(x) + INTEGER, INTENT(in) :: x + WRITE (*,*) 'A: ', x + END SUBROUTINE + SUBROUTINE sub_b(y) + INTEGER, INTENT(in) :: y + WRITE (*,*) 'B: ', y + END SUBROUTINE + SUBROUTINE sub_c(x, y) + REAL, INTENT(in) :: x, y + WRITE(*,*) x, y + END SUBROUTINE +END MODULE +! { dg-final { cleanup-modules "global" } }