public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/42000]  New: missing -Wuninitialized warning on a user-defined class ctor
@ 2009-11-10 23:36 msebor at gmail dot com
  2009-11-11 11:50 ` [Bug c++/42000] " redi at gcc dot gnu dot org
  2009-11-19 12:29 ` manu at gcc dot gnu dot org
  0 siblings, 2 replies; 3+ messages in thread
From: msebor at gmail dot com @ 2009-11-10 23:36 UTC (permalink / raw)
  To: gcc-bugs

gcc misses the access to the uninitialized member S::i in the program below
and fails to issue a warning for it.

I would expect to see a warning not only for the access to the member but
also for the definition of the user-defined constructor that fails to
initialize the data member.

$ cat t.cpp && gcc -Wuninitialized -Wall -Wextra -W -c t.cpp
int main () {
    struct S {
        int i;
        S() { }
    } s;

    return s.i;
}


-- 
           Summary: missing -Wuninitialized warning on a user-defined class
                    ctor
           Product: gcc
           Version: 4.4.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: msebor at gmail dot com


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


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

* [Bug c++/42000] missing -Wuninitialized warning on a user-defined class ctor
  2009-11-10 23:36 [Bug c++/42000] New: missing -Wuninitialized warning on a user-defined class ctor msebor at gmail dot com
@ 2009-11-11 11:50 ` redi at gcc dot gnu dot org
  2009-11-19 12:29 ` manu at gcc dot gnu dot org
  1 sibling, 0 replies; 3+ messages in thread
From: redi at gcc dot gnu dot org @ 2009-11-11 11:50 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from redi at gcc dot gnu dot org  2009-11-11 11:50 -------
It would certainly be nice to get warnings about members that are not
initialized in the constructor, I don't think GCC currently does that anywhere.

If you add -O then you will get a warning for the use of the member.  It's
unfortunate that this warning is missed without optimisation, but
-Wuninitialized no longer warns if you use it without -O


-- 


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


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

* [Bug c++/42000] missing -Wuninitialized warning on a user-defined class ctor
  2009-11-10 23:36 [Bug c++/42000] New: missing -Wuninitialized warning on a user-defined class ctor msebor at gmail dot com
  2009-11-11 11:50 ` [Bug c++/42000] " redi at gcc dot gnu dot org
@ 2009-11-19 12:29 ` manu at gcc dot gnu dot org
  1 sibling, 0 replies; 3+ messages in thread
From: manu at gcc dot gnu dot org @ 2009-11-19 12:29 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from manu at gcc dot gnu dot org  2009-11-19 12:28 -------
I think this is a duplicate of either bug 2972 or bug 19808 or one of the SRA
testcases.


-- 

manu at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |manu at gcc dot gnu dot org
OtherBugsDependingO|                            |24639
              nThis|                            |


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


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

end of thread, other threads:[~2009-11-19 12:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-11-10 23:36 [Bug c++/42000] New: missing -Wuninitialized warning on a user-defined class ctor msebor at gmail dot com
2009-11-11 11:50 ` [Bug c++/42000] " redi at gcc dot gnu dot org
2009-11-19 12:29 ` manu 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).