This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug fortran/63744] [4.8/4.9/5 Regression] Duplicate use-statement causes error


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63744

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|burnus@net-b.de             |

--- Comment #4 from Tobias Burnus <burnus at gcc dot gnu.org> ---
(In reply to Dominique d'Humieres from comment #3)
> > 11.2.2 The USE statement and use association
> > ...
> > R1111 rename is local-name => use-name
> > ...
> > NOTE 11.9
> > There is no prohibition against a use-name or use-defined-operator appearing
> > multiple times in one USE statement or in multiple USE statements involving
> > the same module. As a result, it is possible for one use-associated entity
> > to be accessible by more than one local identier.

But that means things like:
  use m, only: A => X
  use m, only: B => X
which makes m's X (use-name) available under the names A and B (local-name).

In the case at hand, we have something more like:
  use m, only: A => X
  use m, only: A => Y
i.e. the LHS (local-name) is the same. In this example of mine A and A point to
a different object (X and Y), which is clearly ambiguous and invalid (at least
as soon as "A" is used). The question is whether it becomes valid if one uses:
  use m, only: A => X
  use m, only: A => X
i.e. the same object on the RHS.

The Fortran standard has:
"Within its scope, a local identifier of one class shall not be the same as
another local identifier of the same class, except that a generic name may be
the same as the name of a procedure as explained in 12.4.3.5 or the same as
the name of a derived type (4.5.10). A local identifier of one class may be the
same as a local identifier of another class." (F2015 draft, 14-007r2, 16.3.1)

And in the module section (11.2.2)
"Two or more accessible entities, other than generic interfaces or defined
operators, may have the same local identifier only if the identifier is not
used. Generic interfaces and defined operators are handled as described in
12.4.3.5. Except for these cases, the local identifier of any entity given
accessibility by a USE statement shall differ from the local identifiers of all
other entities accessible to the scoping unit."

I have to admit that I am unsure whether it is valid or not.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]