diff options
author | Paul Thomas <pault@gcc.gnu.org> | 2006-11-28 05:36:07 +0000 |
---|---|---|
committer | Paul Thomas <pault@gcc.gnu.org> | 2006-11-28 05:36:07 +0000 |
commit | 911a40abe03cc49145102efa3881e129c9d9b528 (patch) | |
tree | f84fbfbcbc1d745269318450cc377786650ce509 /gcc | |
parent | b93029150149dce2e8d2d3948b5e8d7fbd14c26e (diff) | |
download | gcc-911a40abe03cc49145102efa3881e129c9d9b528.zip gcc-911a40abe03cc49145102efa3881e129c9d9b528.tar.gz gcc-911a40abe03cc49145102efa3881e129c9d9b528.tar.bz2 |
re PR fortran/20880 (USE association of procedure's own interface)
2006-11-28 Paul Thomas <pault@gcc.gnu.org>
PR fortran/20880
* resolve.c (resolve_fl_procedure): Error if procedure is
ambiguous modified to require attr.referenced.
2006-11-28 Paul Thomas <pault@gcc.gnu.org>
PR fortran/20880
* gfortran.dg/interface_3.f90: Modify errors.
From-SVN: r119272
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/fortran/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/fortran/resolve.c | 4 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/interface_3.f90 | 30 |
4 files changed, 41 insertions, 4 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 4c8a2ec..1db6036 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,9 @@ +2006-11-28 Paul Thomas <pault@gcc.gnu.org> + + PR fortran/20880 + * resolve.c (resolve_fl_procedure): Error if procedure is + ambiguous modified to require attr.referenced. + 2006-11-26 Francois-Xavier Coudert <coudert@clipper.ens.fr> PR fortran/29892 diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c index a4d220a..fd544c9 100644 --- a/gcc/fortran/resolve.c +++ b/gcc/fortran/resolve.c @@ -5523,7 +5523,9 @@ resolve_fl_procedure (gfc_symbol *sym, int mp_flag) return FAILURE; st = gfc_find_symtree (gfc_current_ns->sym_root, sym->name); - if (st && st->ambiguous && !sym->attr.generic) + if (st && st->ambiguous + && sym->attr.referenced + && !sym->attr.generic) { gfc_error ("Procedure %s at %L is ambiguous", sym->name, &sym->declared_at); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 95ab61c..89b0464 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2006-11-28 Paul Thomas <pault@gcc.gnu.org> + + PR fortran/20880 + * gfortran.dg/interface_3.f90: Modify errors. + 2006-11-28 Ben Elliston <bje@au.ibm.com> * lib/gcc-defs.exp (${tool}_check_compile): xfail test cases that diff --git a/gcc/testsuite/gfortran.dg/interface_3.f90 b/gcc/testsuite/gfortran.dg/interface_3.f90 index 3832415..ecc7c4f 100644 --- a/gcc/testsuite/gfortran.dg/interface_3.f90 +++ b/gcc/testsuite/gfortran.dg/interface_3.f90 @@ -18,14 +18,25 @@ interface end interface end module -! This is the original PR -subroutine my_sub (a) ! { dg-error "is ambiguous" } +module test_mod2 +interface + function my_fun (a) + real a, my_fun + end function +end interface +end module + + +! This is the original PR, excepting that the error requires the symbol +! to be referenced. +subroutine my_sub (a) use test_mod real a + call my_sub (a) ! { dg-error "ambiguous reference" } print *, a end subroutine -integer function my_fun (a) ! { dg-error "is ambiguous" } +integer function my_fun (a) use test_mod real a print *, a @@ -42,4 +53,17 @@ subroutine thy_sub (a) real a print *, a end subroutine + +subroutine thy_fun (a) + use test_mod + use test_mod2 ! OK because there is no reference to my_fun + print *, a +end subroutine thy_fun + +subroutine his_fun (a) + use test_mod + use test_mod2 + print *, my_fun (a) ! { dg-error "ambiguous reference" } +end subroutine his_fun + ! { dg-final { cleanup-modules "test_mod" } } |