From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11995 invoked by alias); 5 Nov 2014 08:46:01 -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 11965 invoked by uid 48); 5 Nov 2014 08:45:58 -0000 From: "roger.ferrer at bsc dot es" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/63744] New: Duplicate use-statement causes error Date: Wed, 05 Nov 2014 08:46:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new 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: roger.ferrer at bsc dot es X-Bugzilla-Status: UNCONFIRMED 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: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter Message-ID: 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/msg00235.txt.bz2 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63744 Bug ID: 63744 Summary: Duplicate use-statement causes error Product: gcc Version: 4.9.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: roger.ferrer at bsc dot es Hi, (I guess this is related to PR34657) The following snippet is accepted by gfortran -- test-ok.f90 MODULE MOO INTEGER :: S END MODULE MOO SUBROUTINE S1 USE MOO, ONLY: X => S, X => S X = 1 END SUBROUTINE S1 -- end of test-ok.f90 but it is rejected if the program unit SUBROUTINE S1 is renamed to SUBROUTINE S, as shown below -- test.f90 MODULE MOO INTEGER :: S END MODULE MOO SUBROUTINE S USE MOO, ONLY: X => S, X => S X = 1 END SUBROUTINE S -- end of test.f90 $ gfortran -c test.f90 test.f90:6.8: USE MOO, ONLY: X => S, X => S 1 Error: 's' of module 'moo', imported at (1), is also the name of the current program unit test.f90:8.5: X = 1 1 Error: Name 'x' at (1) is an ambiguous reference to 's' from module 'moo' Removing the second rename lets the code be accepted. USE MOO, ONLY: X => S A similar behaviour is observed if we have two repeated USE-statements rather than two repeated rename's in the rename-list USE MOO, ONLY: X => S USE MOO, ONLY: X => S Kind regards,