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: unassig...@gcc.gnu.org
        ReportedBy: bil.k...@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

Reply via email to