From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11375 invoked by alias); 15 Nov 2012 12:51:54 -0000 Received: (qmail 11347 invoked by uid 48); 15 Nov 2012 12:51:37 -0000 From: "jwillemsen at remedy dot nl" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/55340] New: Invalid maybe unitialized warning Date: Thu, 15 Nov 2012 12:51:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: jwillemsen at remedy dot nl X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2012-11/txt/msg01402.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D55340 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=3D28698 gzip with both preprocessed files We have in some of our tests a warning that a variable may be used unitiali= zed, but we have validated that this is not the case (as far as we could tell).= =20 We tried to reduce our code to a minimum, but the strange thing is that whe= n we remove some not related code, the warning is gone.=20 Attached 2 preprocessed files, t.cpp t2.cpp, compile using: g++ --std=3Dc++0x -fno-strict-aliasing -fvisibility=3Dhidden -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:=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20 testC.h: In member function =E2=80=98void Test::union_union::swap(Test::uni= on_union&)=E2=80=99:=20 testC.h:764:3: warning: =E2=80=98*((void*)(& intermediate)+8).Test::unionTy= pe::disc_=E2=80=99 may be used uninitialized in this function [-Wmaybe-uninitialized]=20=20=20= =20=20=20=20=20=20=20=20=20=20=20 testC.h:1325:27: note: =E2=80=98*((void*)(& intermediate)+8).Test::unionTyp= e::disc_=E2=80=99 was declared here=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20 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 th= ere. We have reduced the code to the point that removal of any type would not trigger the warning.