public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [Patch, Fortran] PR54199 improve warning "is also the name of an intrinsic" for internal procedures
@ 2012-08-09  9:13 Tobias Burnus
  2012-08-09 11:13 ` Mikael Morin
  0 siblings, 1 reply; 2+ messages in thread
From: Tobias Burnus @ 2012-08-09  9:13 UTC (permalink / raw)
  To: gcc patches, gfortran

[-- Attachment #1: Type: text/plain, Size: 329 bytes --]

This patch makes the warning for internal procedures whose name is the 
same as the one of an intrinsic clearer. Initially, I though that one 
shouldn't warn for internal procedures, but others disagree. In any 
case, the warning text is better than original one.

Build and regstested on x86-64-linux.
OK for the trunk?

Tobias

[-- Attachment #2: intrinsic-shadow.diff --]
[-- Type: text/x-patch, Size: 1333 bytes --]

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.

diff --git a/gcc/fortran/intrinsic.c b/gcc/fortran/intrinsic.c
index 60c68fe..72b149f 100644
--- a/gcc/fortran/intrinsic.c
+++ b/gcc/fortran/intrinsic.c
@@ -4503,7 +4511,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.",
--- /dev/null	2012-08-08 07:41:43.631684108 +0200
+++ gcc/gcc/testsuite/gfortran.dg/intrinsic_shadow_4.f90	2012-08-09 10:28:55.000000000 +0200
@@ -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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [Patch, Fortran] PR54199 improve warning "is also the name of an intrinsic" for internal procedures
  2012-08-09  9:13 [Patch, Fortran] PR54199 improve warning "is also the name of an intrinsic" for internal procedures Tobias Burnus
@ 2012-08-09 11:13 ` Mikael Morin
  0 siblings, 0 replies; 2+ messages in thread
From: Mikael Morin @ 2012-08-09 11:13 UTC (permalink / raw)
  To: Tobias Burnus; +Cc: gcc patches, gfortran

On 09/08/2012 11:12, Tobias Burnus wrote:
> This patch makes the warning for internal procedures whose name is the
> same as the one of an intrinsic clearer. Initially, I though that one
> shouldn't warn for internal procedures, but others disagree. In any
> case, the warning text is better than original one.
> 
> Build and regstested on x86-64-linux.
> OK for the trunk?

OK.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-08-09 11:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-08-09  9:13 [Patch, Fortran] PR54199 improve warning "is also the name of an intrinsic" for internal procedures Tobias Burnus
2012-08-09 11:13 ` Mikael Morin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).