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 c++/55340] New: Invalid maybe unitialized warning


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

             Bug #: 55340
           Summary: Invalid maybe unitialized warning
    Classification: Unclassified
           Product: gcc
           Version: 4.7.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: jwillemsen@remedy.nl


Created attachment 28698
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=28698
gzip with both preprocessed files

We have in some of our tests a warning that a variable may be used unitialized,
but we have validated that this is not the case (as far as we could tell). 

We tried to reduce our code to a minimum, but the strange thing is that when we
remove some not related code, the warning is gone. 

Attached 2 preprocessed files, t.cpp t2.cpp, compile using:
g++ --std=c++0x -fno-strict-aliasing -fvisibility=hidden
-fvisibility-inlines-hidden -O3 -ggdb -m64 -pthread -Wall -W -Wpointer-arith
-pipe -D_GNU_SOURCE    -c t.cpp

When compiling t.cpp we get:
In file included from testC.cpp:26:0:                                           
testC.h: In member function âvoid Test::union_union::swap(Test::union_union&)â: 
testC.h:764:3: warning: â*((void*)(& intermediate)+8).Test::unionType::disc_â
may be used uninitialized in this function [-Wmaybe-uninitialized]              
testC.h:1325:27: note: â*((void*)(& intermediate)+8).Test::unionType::disc_â
was declared here                                                               
When compiling t2.cpp there is no warning. If you check the diff between t.cpp
and t2.cpp you will see that the code that triggers the warning is still there.

We have reduced the code to the point that removal of any type would not
trigger the warning.


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