public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/58177] New: Incorrect warning message about unused PRIVATE module variable
@ 2013-08-16 23:42 abensonca at gmail dot com
  2013-08-18 15:04 ` [Bug fortran/58177] " abensonca at gmail dot com
  2013-08-18 15:14 ` tkoenig at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: abensonca at gmail dot com @ 2013-08-16 23:42 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 58177
           Summary: Incorrect warning message about unused PRIVATE module
                    variable
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: abensonca at gmail dot com

With gfortran 4.9.0 (r201758) the following incorrectly reports than the
variable "m" in module "b" is unused:

module a
  logical :: m
end module a
module b
  logical, private :: m
contains
  subroutine bb()
    use a
    m=.true.
  end subroutine bb
end module b

$ gfortran -v                                                                   
Using built-in specs.                                                           
COLLECT_GCC=gfortran                                                            
COLLECT_LTO_WRAPPER=/home/abenson/Galacticus/Tools/libexec/gcc/x86_64-unknown-linux-gnu/4.9.0/lto-wrapper 
Target: x86_64-unknown-linux-gnu                                                
Configured with: ../gcc-trunk/configure --prefix=/home/abenson/Galacticus/Tools
--enable-languages=c,c++,fortran --disable-multilib
--with-gmp=/home/abenson/Galacticus/Tools                                       
Thread model: posix                                                             
gcc version 4.9.0 20130815 (experimental) (GCC)                                 
$ gfortran -c bug.F90 -o bug.o -Wall
bug.F90:5.23:                                                                   

  logical, private :: m                                                         
                       1
Warning: Unused PRIVATE module variable 'm' declared at (1)

The variable "m" in module "b" is used. The problem seems to be related to the
presence of a PUBLIC variable with the same name in another USEd module.
Changing the name of the variable in the USEd module makes the warning go away.
Renaming the imported variable with:

    use a, only : mm => m

results in a correct warning:

Warning: Unused module variable 'm' which has been explicitly imported at (1)

and causes the "Unused PRIVATE" warning to go away.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug fortran/58177] Incorrect warning message about unused PRIVATE module variable
  2013-08-16 23:42 [Bug fortran/58177] New: Incorrect warning message about unused PRIVATE module variable abensonca at gmail dot com
@ 2013-08-18 15:04 ` abensonca at gmail dot com
  2013-08-18 15:14 ` tkoenig at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: abensonca at gmail dot com @ 2013-08-18 15:04 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Andrew Benson <abensonca at gmail dot com> ---
You're absolutely correct -  my mistake!


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug fortran/58177] Incorrect warning message about unused PRIVATE module variable
  2013-08-16 23:42 [Bug fortran/58177] New: Incorrect warning message about unused PRIVATE module variable abensonca at gmail dot com
  2013-08-18 15:04 ` [Bug fortran/58177] " abensonca at gmail dot com
@ 2013-08-18 15:14 ` tkoenig at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: tkoenig at gcc dot gnu.org @ 2013-08-18 15:14 UTC (permalink / raw)
  To: gcc-bugs

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

Thomas Koenig <tkoenig at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |INVALID

--- Comment #3 from Thomas Koenig <tkoenig at gcc dot gnu.org> ---
Closing, then.

Do keep these bug reports, coming, though :-)


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-08-18 15:14 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-08-16 23:42 [Bug fortran/58177] New: Incorrect warning message about unused PRIVATE module variable abensonca at gmail dot com
2013-08-18 15:04 ` [Bug fortran/58177] " abensonca at gmail dot com
2013-08-18 15:14 ` tkoenig at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).