]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR fortran/20880 (USE association of procedure's own interface)
authorPaul Thomas <pault@gcc.gnu.org>
Tue, 28 Nov 2006 05:36:07 +0000 (05:36 +0000)
committerPaul Thomas <pault@gcc.gnu.org>
Tue, 28 Nov 2006 05:36:07 +0000 (05:36 +0000)
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

gcc/fortran/ChangeLog
gcc/fortran/resolve.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/interface_3.f90

index 4c8a2ecda68294ce0e395122a73db7991a2287b8..1db60367918655ba12c58f72e20e217e74fd2265 100644 (file)
@@ -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
index a4d220ae744ae2b68ac509ba738b92f0ce13118d..fd544c9a33bba0fce17b314cbc57abdcc471ddf7 100644 (file)
@@ -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);
index 95ab61cb7765a3a468a6313639024bb028221289..89b0464f272349416ea8ddc36361d76996eaed11 100644 (file)
@@ -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
index 38324152d202e1cce2fd98fcbbf8e526a85ebf27..ecc7c4fa9e38b3bfd2c257ef80f7463776a0be78 100644 (file)
@@ -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" } }