This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/49693] New: Spurious "unused-variable" warnings for COMMON block module variables.
- From: "stephan.kramer at imperial dot ac.uk" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sat, 9 Jul 2011 22:25:23 +0000
- Subject: [Bug fortran/49693] New: Spurious "unused-variable" warnings for COMMON block module variables.
- Auto-submitted: auto-generated
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49693
Summary: Spurious "unused-variable" warnings for COMMON block
module variables.
Product: gcc
Version: 4.6.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: stephan.kramer@imperial.ac.uk
As of gfortran 4.6, module variables that are also part of a common block cause
spurious "unused variable" warnings. The following example
module foo
implicit none
integer:: a, b
common a
end module foo
produces:
$ gfortran -c -Wall test.f90
test.f90:3:0: warning: âaâ defined but not used [-Wunused-variable]
Although common variables are deprecated they're still commonly used in
libraries such as mpi and petsc to define some global paramaters. I therefore
get quite a few warning messages in every module that uses these (and also
everywhere module that subsequently uses such modules). Example here with
openmpi:
$ cat test.f90
module foo
use mpi
use petsc
end module
$ mpif90 -I/usr/lib/petscdir/3.1/linux-gnu-c-opt/include/ -Wall -c test.f90
test.f90:2:0: warning: âmpi_argv_nullâ defined but not used
test.f90:2:0: warning: âmpi_in_placeâ defined but not used
test.f90:2:0: warning: âmpi_status_ignoreâ defined but not used
test.f90:2:0: warning: âmpi_statuses_ignoreâ defined but not used
test.f90:3:0: warning: âpetsc_comm_selfâ defined but not used
test.f90:3:0: warning: âpetsc_null_integerâ defined but not used
test.f90:3:0: warning: âpetsc_nullâ defined but not used
test.f90:3:0: warning: âpetsc_null_scalarâ defined but not used
test.f90:3:0: warning: âpetsc_null_doubleâ defined but not used
test.f90:3:0: warning: âpetsc_null_realâ defined but not used
test.f90:3:0: warning: âpetsc_null_truthâ defined but not used
test.f90:2:0: warning: âmpi_argvs_nullâ defined but not used
test.f90:3:0: warning: âpetsc_null_objectâ defined but not used
test.f90:3:0: warning: âpetsc_comm_worldâ defined but not used
test.f90:2:0: warning: âmpi_argv_nullâ defined but not used
test.f90:2:0: warning: âmpi_argvs_nullâ defined but not used
test.f90:2:0: warning: âmpi_bottomâ defined but not used
test.f90:2:0: warning: âmpi_errcodes_ignoreâ defined but not used
test.f90:2:0: warning: âmpi_in_placeâ defined but not used
test.f90:2:0: warning: âmpi_status_ignoreâ defined but not used
test.f90:2:0: warning: âmpi_statuses_ignoreâ defined but not used
test.f90:3:0: warning: âpetsc_null_characterâ defined but not used
test.f90:2:0: warning: âmpi_bottomâ defined but not used
test.f90:2:0: warning: âmpi_errcodes_ignoreâ defined but not used