re PR fortran/29652 (ambiguous interface declaration undetected)

2006-11-22 Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/29652
	* interface.c (check_interface1): Use a local value, instead of
	the dummy, as the inner iterator over interface symbols.

2006-11-22 Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/29652
	* gfortran.dg/generic_7.f90: New test.
	* gfortran.dg/defined_operators_1.f90: Add new error.

From-SVN: r119076
This commit is contained in:
Paul Thomas 2006-11-22 00:02:02 +00:00
parent ac8f6c6903
commit 991f3b1289
5 changed files with 43 additions and 4 deletions

View File

@ -1,3 +1,9 @@
2006-11-22 Paul Thomas <pault@gcc.gnu.org>
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 <pault@gcc.gnu.org>
PR fortran/29820

View File

@ -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 */

View File

@ -1,3 +1,9 @@
2006-11-22 Paul Thomas <pault@gcc.gnu.org>
PR fortran/29652
* gfortran.dg/generic_7.f90: New test.
* gfortran.dg/defined_operators_1.f90: Add new error.
2006-11-22 Zdenek Dvorak <dvorakz@suse.cz>
PR tree-optimization/29902

View File

@ -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

View File

@ -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 <franke.daniel@gmail.com>
!
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" } }