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

module test
contains

subroutine sub1 (arg1)
  integer arg1
  integer var1
end subroutine

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

end module test

[EMAIL PROTECTED]:~/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


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28817

Reply via email to