[Bug fortran/28817] New: [gfortran] problems with -Wunused

martin at mpa-garching dot mpg dot de gcc-bugzilla@gcc.gnu.org
Wed Aug 23 08:28:00 GMT 2006

The following code causes current mainline gfortran to produce warnings
about unused variables that are somewhat confused.

module test

subroutine sub1 (arg1)
  integer arg1
  integer var1
end subroutine

subroutine sub2 (arg2)
  integer arg2
  integer var2
  call something(arg2)
end subroutine

end module test

martin@linux:~/tmp> gfortran -c -Wunused test.f90
test.f90: In function ‘sub2’:
test.f90:4: warning: unused variable ‘var2’
test.f90: In function ‘sub1’:
test.f90:12: warning: unused variable ‘arg1’
test.f90:12: warning: unused variable ‘var1’

The diagnostics appear in the wrong order, and the line numbers are confused.
This is most likely related to (or identical with) PR21918.

           Summary: [gfortran] problems with -Wunused
           Product: gcc
           Version: 4.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: martin at mpa-garching dot mpg dot de
 GCC build triplet: x86_64-unknown-linux-gnu
  GCC host triplet: x86_64-unknown-linux-gnu
GCC target triplet: x86_64-unknown-linux-gnu


More information about the Gcc-bugs mailing list