This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/54082] Program name shadows other entities with the same name
- From: "burnus at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 24 Jul 2012 15:53:20 +0000
- Subject: [Bug fortran/54082] Program name shadows other entities with the same name
- Auto-submitted: auto-generated
- References: <bug-54082-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54082
--- Comment #2 from Tobias Burnus <burnus at gcc dot gnu.org> 2012-07-24 15:53:20 UTC ---
(In reply to comment #1)
> (In reply to comment #0)
> > program abs
> > print *, abs(-1)
> > end program
> Back to your example, and quoting from the Fortran standard (cf.
> http://gcc.gnu.org/wiki/GFortranStandards; F2008, Section 16.2):
>
> "Program units, common blocks, external procedures, entities with binding
> labels, external input/output units, pending data transfer operations, and
> images are global entities of a program. [...]"
>
> "The global identifier of an entity shall not be the same as the global
> identifier of any other entity."
>
> Here, "program abs" is a "program unit" and the function "abs" of "abs(-1)" is
> an "external procedure".
Actually, if you meant the intrinsic "abs" function, that the "abs" in
"abs(-1)" is not an "external procedure" and, thus, that "abs" is not a global
name. But a local identifier
"Identifiers of entities in the classes
(1) [...] intrinsic procedures, [...]
are local identifiers."
Nonetheless, it is invalid as:
> As used in my example, the "abs" subroutine is a local
> identifier, which per 16.3.1 "shall not be the same as a global identifier
> used in that scope unless [...]" - thus, I used a different name, i.e "test".)