re PR fortran/54199 (Superfluous diagnostic "is also the name of an intrinsic" for...
authorTobias Burnus <burnus@net-b.de>
Thu, 9 Aug 2012 12:06:31 +0000 (14:06 +0200)
committerTobias Burnus <burnus@gcc.gnu.org>
Thu, 9 Aug 2012 12:06:31 +0000 (14:06 +0200)
2012-08-09  Tobias Burnus  <burnus@net-b.de>

        PR fortran/54199
        * intrinsic.c (gfc_warn_intrinsic_shadow): Better warning
        for internal procedures.

2012-08-09  Tobias Burnus  <burnus@net-b.de>

        PR fortran/54199
        * gfortran.dg/intrinsic_shadow_4.f90: New.

From-SVN: r190251

gcc/fortran/ChangeLog
gcc/fortran/intrinsic.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/intrinsic_shadow_4.f90 [new file with mode: 0644]

index 278f55a337dc03869106ac9fafbb338002490a63..bcdb67988e52d0913f4b765730cd3b85b6fa2a56 100644 (file)
@@ -1,3 +1,9 @@
+2012-08-09  Tobias Burnus  <burnus@net-b.de>
+
+       PR fortran/54199
+       * intrinsic.c (gfc_warn_intrinsic_shadow): Better warning
+       for internal procedures.
+
 2012-08-06  Janus Weil  <janus@gcc.gnu.org>
 
        PR fortran/35831
index 60c68feb624c03fdbb05311f1c80ae92d45c7738..6da131d85537d0aecdc88920e4abd99ad0fa6b7f 100644 (file)
@@ -4503,7 +4503,7 @@ gfc_warn_intrinsic_shadow (const gfc_symbol* sym, bool in_module, bool func)
     return;
 
   /* Emit the warning.  */
-  if (in_module)
+  if (in_module || sym->ns->proc_name)
     gfc_warning ("'%s' declared at %L may shadow the intrinsic of the same"
                 " name.  In order to call the intrinsic, explicit INTRINSIC"
                 " declarations may be required.",
index 73f242ad7bcc94e768ba4ea9fee1ccd50594d962..47066a3f3a9593d73bbd502af40b625d7f1faefa 100644 (file)
@@ -1,3 +1,8 @@
+2012-08-09  Tobias Burnus  <burnus@net-b.de>
+
+       PR fortran/54199
+       * gfortran.dg/intrinsic_shadow_4.f90: New.
+
 2012-08-08  H.J. Lu  <hongjiu.lu@intel.com>
 
        * gcc.dg/tree-ssa/slsr-30.c: Require non-ilp32.  Remove
diff --git a/gcc/testsuite/gfortran.dg/intrinsic_shadow_4.f90 b/gcc/testsuite/gfortran.dg/intrinsic_shadow_4.f90
new file mode 100644 (file)
index 0000000..df614bb
--- /dev/null
@@ -0,0 +1,12 @@
+! { dg-do compile }
+! { dg-options "-Wall" }
+!
+! PR fortran/54199
+!
+subroutine test()
+contains
+  real function fraction(x) ! { dg-warning "'fraction' declared at .1. may shadow the intrinsic of the same name.  In order to call the intrinsic, explicit INTRINSIC declarations may be required." }
+    real :: x
+    fraction = x
+  end function fraction
+end subroutine test