public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/55340] New: Invalid maybe unitialized warning
@ 2012-11-15 12:51 jwillemsen at remedy dot nl
  2012-11-15 14:17 ` [Bug c++/55340] " jwillemsen at remedy dot nl
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: jwillemsen at remedy dot nl @ 2012-11-15 12:51 UTC (permalink / raw)
  To: gcc-bugs


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.


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

* [Bug c++/55340] Invalid maybe unitialized warning
  2012-11-15 12:51 [Bug c++/55340] New: Invalid maybe unitialized warning jwillemsen at remedy dot nl
@ 2012-11-15 14:17 ` jwillemsen at remedy dot nl
  2013-02-27 16:04 ` paolo.carlini at oracle dot com
  2013-02-27 19:20 ` jwillemsen at remedy dot nl
  2 siblings, 0 replies; 4+ messages in thread
From: jwillemsen at remedy dot nl @ 2012-11-15 14:17 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #1 from Johnny Willemsen <jwillemsen at remedy dot nl> 2012-11-15 14:17:38 UTC ---
Lowering optimization from -O3 to -O2 removes the warning


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

* [Bug c++/55340] Invalid maybe unitialized warning
  2012-11-15 12:51 [Bug c++/55340] New: Invalid maybe unitialized warning jwillemsen at remedy dot nl
  2012-11-15 14:17 ` [Bug c++/55340] " jwillemsen at remedy dot nl
@ 2013-02-27 16:04 ` paolo.carlini at oracle dot com
  2013-02-27 19:20 ` jwillemsen at remedy dot nl
  2 siblings, 0 replies; 4+ messages in thread
From: paolo.carlini at oracle dot com @ 2013-02-27 16:04 UTC (permalink / raw)
  To: gcc-bugs


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

Paolo Carlini <paolo.carlini at oracle dot com> changed:

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

--- Comment #2 from Paolo Carlini <paolo.carlini at oracle dot com> 2013-02-27 16:03:22 UTC ---
Mainline (would be 4.8.0) is fine and I can't even compile the testcase with
4_6-branch, thus this isn't a regression.

In the future, please do your best to reduce the size of your testcase: in
99.999 % of the cases, 2-3 KB are enough.


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

* [Bug c++/55340] Invalid maybe unitialized warning
  2012-11-15 12:51 [Bug c++/55340] New: Invalid maybe unitialized warning jwillemsen at remedy dot nl
  2012-11-15 14:17 ` [Bug c++/55340] " jwillemsen at remedy dot nl
  2013-02-27 16:04 ` paolo.carlini at oracle dot com
@ 2013-02-27 19:20 ` jwillemsen at remedy dot nl
  2 siblings, 0 replies; 4+ messages in thread
From: jwillemsen at remedy dot nl @ 2013-02-27 19:20 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #3 from Johnny Willemsen <jwillemsen at remedy dot nl> 2013-02-27 19:20:24 UTC ---
Thanks for checking this, will also try 4.8.0 at some point. We have hundreds
of tests using C++11 extensively and this was the only one exposing this
warning. This is mostly generated code and I tried to reduce it further, but
when I reduced it further the warning was gone. I didn't had a clue why it
could be triggered, that lack of knowledge prevented me from reducing the test
case further


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

end of thread, other threads:[~2013-02-27 19:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-11-15 12:51 [Bug c++/55340] New: Invalid maybe unitialized warning jwillemsen at remedy dot nl
2012-11-15 14:17 ` [Bug c++/55340] " jwillemsen at remedy dot nl
2013-02-27 16:04 ` paolo.carlini at oracle dot com
2013-02-27 19:20 ` jwillemsen at remedy dot nl

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).