The Fortran code

$ cat unused.f90 
subroutine a(x)
  implicit none
  real x
end subroutine a

gives the warning

$ ~/gcc/bin/gfortran -c unused.f90 -Wall
unused.f90: In function ‘a’:
unused.f90:1: warning: unused variable ‘x’

when compiled with

$ ~/gcc/bin/gfortran --version
GNU Fortran 95 (GCC) 4.1.0 20051030 (experimental)

I find the text of this warning confusing, because the unused entity is an
argument, not a variable.  It is always possible to remove unused local
variables from a routine's body, but changing a routine's list of arguments is
sometimes not feasible.  Warnings about unused variables and unused arguments
should therefore be separate.  The warning should instead read "unused argument
'x'".


-- 
           Summary: Warning about unused routine argument should not read
                    "unused variable"
           Product: gcc
           Version: 4.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: schnetter at aei dot mpg dot de
 GCC build triplet: powerpc-apple-darwin8.3.0
  GCC host triplet: powerpc-apple-darwin8.3.0
GCC target triplet: powerpc-apple-darwin8.3.0


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

Reply via email to