This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug pending/64214] New: no warning for unused global


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64214

            Bug ID: 64214
           Summary: no warning for unused global
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: pending
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jg at jguk dot org

gcc (Ubuntu 4.8.2-19ubuntu1) 4.8.2

$ g++ -O -Wunused-variable -Werror -Wall -o main gcc_unused.cpp

compiles ok. I had expected it to report the unused global variable:


bool glob = false;

int main()
{
    return 0;
}

if I make the global "static" gcc does report :

gcc_unused.cpp:3:13: error: âglobâ defined but not used
[-Werror=unused-variable]

However, could gcc report even when it is not static?

Thank you for considering this.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]