http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53940

Tobias Burnus <burnus at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |burnus at gcc dot gnu.org

--- Comment #1 from Tobias Burnus <burnus at gcc dot gnu.org> 2012-07-12 
13:08:51 UTC ---
(In reply to comment #0)
> The old DEC Alpha compiler does:
[...]
> f90: Error: duplicate_use.f90, line 8: The same named entity from different
> modules and/or program units cannot be referenced.   [VAR]
>   print*, var
> ----------^

That that one is completely bogus. The standard allows multiple inclusion of
the same variable; and your variable is - contrary to the error message - from
the same module. For instance, the following is valid:

  use mod
  use mod, var2 => var

That way one has use-associated the variable "var" under the name "var" and
under the name "var2".


The Fortran standard (here: Fortran 2008, "11.2.2 The USE statement and use
association") has:

"More than one USE statement for a given module may appear in a specification
part. If one of the USE statements is without an ONLY option, all public
entities in the module are accessible. If all the USE statements have ONLY
options, only those entities in one or more of the only-lists are accessible.

"An accessible entity in the referenced module has one or more local
identifiers. [...]" (Cf. http://gcc.gnu.org/wiki/GFortranStandards)


Hence, I am inclined to reject the warning proposal. (The request to print an 
error is simply invalid.)

However, if you can give a good argument why you want to have a special warning
and when it exactly should be triggered, one could consider it. However, I
currently fail to see a real use case for that.

Note: module entities which have been explicitly use associated but aren't used
are warned for. Thus, one could consider to warn if the same entity under the
same name is multiple times use associated. However, that's not only valid but
seems to be also harmless and a rather special case.

Reply via email to