This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/53940] New: warn about duplicate USE
- From: "Bil.Kleb at NASA dot gov" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 12 Jul 2012 12:33:13 +0000
- Subject: [Bug fortran/53940] New: warn about duplicate USE
- Auto-submitted: auto-generated
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53940
Bug #: 53940
Summary: warn about duplicate USE
Classification: Unclassified
Product: gcc
Version: 4.6.2
Status: UNCONFIRMED
Severity: enhancement
Priority: P3
Component: fortran
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: Bil.Kleb@NASA.gov
Hi,
I'd like to see the GFortran compiler at least give a warning if a USE is
duplicated, viz,
$ cat > duplicate_use.f90 << EOF
module mod
integer :: var = 0
end module
program duplicate_use
use mod, only: var
use mod, only: var ! should produce error
print*, var
end program
EOF
$ gfortran --version | head -1
GNU Fortran (GCC) 4.6.2 20111019 (prerelease)
$ gfortran -W -Wall -Wextra -pedantic-errors duplicate_use.f90
[no complaints]
The old DEC Alpha compiler does:
alpha% fort -what
Compaq Fortran V1.2.0-1882
Compaq Fortran Compiler V1.2.0-1882-48BBF
alpha% fort -c duplicate_use.f90
f90: Warning: duplicate_use.f90, line 6: Conflicting attributes or multiple
declaration of name. [VAR]
use mod, only: var
-----------------^
f90: Error: duplicate_use.f90, line 8: The same named entity from different
modules and/or program units cannot be referenced. [VAR]
print*, var
----------^
Thanks for consideration,
--
Bil