From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3392 invoked by alias); 15 Nov 2014 17:00:30 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 3332 invoked by uid 48); 15 Nov 2014 17:00:24 -0000 From: "burnus at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/63744] [4.8/4.9/5 Regression] Duplicate use-statement causes error Date: Sat, 15 Nov 2014 17:00:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: fortran X-Bugzilla-Version: 4.9.1 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: burnus at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cc Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2014-11/txt/msg01366.txt.bz2 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63744 Tobias Burnus changed: What |Removed |Added ---------------------------------------------------------------------------- CC|burnus@net-b.de | --- Comment #4 from Tobias Burnus --- (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.