bogus unused module variable warning

Anton Shterenlikht mexas@bristol.ac.uk
Mon Feb 5 12:21:00 GMT 2018


Hi

I have a module with submodules.
A submodule uses module variables by host association.
These variables are not used in the module file.
Hence I get warnings like this:

   mpi_h3_rv        ! MPI halo, dim 3, right virtual
           1
Warning: Unused PRIVATE module variable 'mpi_h3_rv' declared at (1) [-Wunused-value]

I guess this is because when the module file is
compiled, there is no way to know whether any
of the unused variables are used in submodules.

Even I compile both the module and the submodule file
at the same, i.e. in the same gfortran command invocation,
I get this unused warning.

I like to compile with -Wall, and I pay attention to
all warnings.

Is there a way make gfortran "see" that module
variables are used in a submodule?

Thanks

Anton



More information about the Fortran mailing list