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,