public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/45609]  New: 'is used uninitialized' becomes 'may be used uninitialized' on unrelated code changes (namespace addition)
@ 2010-09-09  6:21 gcc at abeckmann dot de
  2010-09-09  6:25 ` [Bug c++/45609] " gcc at abeckmann dot de
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: gcc at abeckmann dot de @ 2010-09-09  6:21 UTC (permalink / raw)
  To: gcc-bugs

(I looked for duplicate -Wuninitialized bugs but didn't see anything similar)

In the attached minimized testcase I get a clear 'is used uninitialized'
warning downgraded to a 'may be used uninitialized' warning on unrelated code
changes.

The program compiles correctly with the following flags: -O3 -Wall
To move one function definition into a namespace, add -DBAD_NAMESPACE and get
the wrong warning.
Reordering/removing/adding/changing the sizes of local variables makes the
warning restore to 'is used uninitialized', one example can be enabled by
-DGOOD_ORDER

This is a regression since 4.3 as 4.2 always gives a 'is used uninitialized'
warning. I tested with the following compilers from SVN on amd64 and x86
architectures:

g++-trunk (GCC) 4.6.0 20100901 (experimental) ==> BAD
g++-4.5.x (GCC) 4.5.2 20100901 (prerelease) ==> BAD
g++-4.4.x (GCC) 4.4.5 20100824 (prerelease) ==> BAD
g++-4.3.x (GCC) 4.3.6 20100824 (prerelease) ==> BAD
g++-4.2.x (GCC) 4.2.5 20090330 (prerelease) ==> OK

+ g++-4.5.x -std=c++0x -O3 -Wall -c PRmbuuitf.cpp
PRmbuuitf.cpp: In function 'void test()':
PRmbuuitf.cpp:66:25: warning: 'b$t$MBUUITF' is used uninitialized in this
function
PRmbuuitf.cpp:64:5: note: 'b$t$MBUUITF' was declared here
+ g++-4.5.x -std=c++0x -O3 -Wall -c PRmbuuitf.cpp -DBAD_NAMESPACE
PRmbuuitf.cpp: In function 'void test()':
                                            vvv
PRmbuuitf.cpp:66:25: warning: 'b$t$MBUUITF' may be used uninitialized in this
function
                                            ^^^
PRmbuuitf.cpp:64:5: note: 'b$t$MBUUITF' was declared here
+ g++-4.5.x -std=c++0x -O3 -Wall -c PRmbuuitf.cpp -DBAD_NAMESPACE -DGOOD_ORDER
PRmbuuitf.cpp: In function 'void test()':
PRmbuuitf.cpp:66:25: warning: 'b$t$MBUUITF' is used uninitialized in this
function
PRmbuuitf.cpp:64:5: note: 'b$t$MBUUITF' was declared here

+ g++-4.2.x -O3 -Wall -c PRmbuuitf.cpp -DBAD_NAMESPACE
PRmbuuitf.cpp: In function 'void test()':
PRmbuuitf.cpp:66: warning: 'b.B::t.T::MBUUITF' is used uninitialized in this
function
PRmbuuitf.cpp:64: note: 'b.B::t.T::MBUUITF' was declared here


-- 
           Summary: 'is used uninitialized' becomes 'may be used
                    uninitialized' on unrelated code changes (namespace
                    addition)
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: gcc at abeckmann dot de


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


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

* [Bug c++/45609] 'is used uninitialized' becomes 'may be used uninitialized' on unrelated code changes (namespace addition)
  2010-09-09  6:21 [Bug c++/45609] New: 'is used uninitialized' becomes 'may be used uninitialized' on unrelated code changes (namespace addition) gcc at abeckmann dot de
@ 2010-09-09  6:25 ` gcc at abeckmann dot de
  2010-09-09  8:01 ` [Bug c++/45609] [Regression 4.3/4.4/4.5/4.6] " manu at gcc dot gnu dot org
  2010-09-09 11:57 ` [Bug c++/45609] [4.3/4.4/4.5/4.6 Regression] " jakub at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: gcc at abeckmann dot de @ 2010-09-09  6:25 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from gcc at abeckmann dot de  2010-09-09 06:24 -------
Created an attachment (id=21746)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=21746&action=view)
minimized testcase


-- 


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


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

* [Bug c++/45609] [Regression 4.3/4.4/4.5/4.6] 'is used uninitialized' becomes 'may be used uninitialized' on unrelated code changes (namespace addition)
  2010-09-09  6:21 [Bug c++/45609] New: 'is used uninitialized' becomes 'may be used uninitialized' on unrelated code changes (namespace addition) gcc at abeckmann dot de
  2010-09-09  6:25 ` [Bug c++/45609] " gcc at abeckmann dot de
@ 2010-09-09  8:01 ` manu at gcc dot gnu dot org
  2010-09-09 11:57 ` [Bug c++/45609] [4.3/4.4/4.5/4.6 Regression] " jakub at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: manu at gcc dot gnu dot org @ 2010-09-09  8:01 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from manu at gcc dot gnu dot org  2010-09-09 08:00 -------
In any case, this is a clear regression of the pretty printer.


-- 

manu at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |manu at gcc dot gnu dot org
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2010-09-09 08:00:56
               date|                            |
            Summary|'is used uninitialized'     |[Regression 4.3/4.4/4.5/4.6]
                   |becomes 'may be used        |'is used uninitialized'
                   |uninitialized' on unrelated |becomes 'may be used
                   |code changes (namespace     |uninitialized' on unrelated
                   |addition)                   |code changes (namespace
                   |                            |addition)
   Target Milestone|---                         |4.3.6


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


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

* [Bug c++/45609] [4.3/4.4/4.5/4.6 Regression] 'is used uninitialized' becomes 'may be used uninitialized' on unrelated code changes (namespace addition)
  2010-09-09  6:21 [Bug c++/45609] New: 'is used uninitialized' becomes 'may be used uninitialized' on unrelated code changes (namespace addition) gcc at abeckmann dot de
  2010-09-09  6:25 ` [Bug c++/45609] " gcc at abeckmann dot de
  2010-09-09  8:01 ` [Bug c++/45609] [Regression 4.3/4.4/4.5/4.6] " manu at gcc dot gnu dot org
@ 2010-09-09 11:57 ` jakub at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: jakub at gcc dot gnu dot org @ 2010-09-09 11:57 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from jakub at gcc dot gnu dot org  2010-09-09 11:56 -------
I don't see any problem.  All of current trunk, 4.5 and 4.4 print it as
b.B::t.T::MBUUITF
rather than
b$t$MBUUITF
and the other difference in the warning message is not caused by unrelated code
changes, but actually very much related.
With -UBAD_NAMESPACE ::f() function is defined in the current TU and thus the
compiler knows it doesn't throw and that D::D() doesn't throw either, with
-DBAD_NAMESPACE ::f() is only declared and so the compiler doesn't know it it
throws or doesn't, and similarly for D::D().  The is used uninitialized warning
is emitted only in basic blocks that are always executed (with -UBAD_NAMESPACE
if A::A() is called, it will always pass the uninitialized var to C::g(int);
with -DBAD_NAMESPACE if ::f() throws then that wouldn't happen.


-- 

jakub at gcc dot gnu dot org changed:

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


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


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

end of thread, other threads:[~2010-09-09 11:57 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-09-09  6:21 [Bug c++/45609] New: 'is used uninitialized' becomes 'may be used uninitialized' on unrelated code changes (namespace addition) gcc at abeckmann dot de
2010-09-09  6:25 ` [Bug c++/45609] " gcc at abeckmann dot de
2010-09-09  8:01 ` [Bug c++/45609] [Regression 4.3/4.4/4.5/4.6] " manu at gcc dot gnu dot org
2010-09-09 11:57 ` [Bug c++/45609] [4.3/4.4/4.5/4.6 Regression] " jakub at gcc dot gnu dot 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).