GCC Bugzilla will be upgraded from version 4.4.9 to 5.0rc3 on Saturday, April 25, starting around 17:00 UTC. The upgrade process should only last a few minutes. Check bug 64968 for details.
Bug 39936 - [4.4 only] -Wuninitialized false positive with unhelpful diagnostic
[4.4 only] -Wuninitialized false positive with unhelpful diagnostic
Status: RESOLVED FIXED
Product: gcc
Classification: Unclassified
Component: middle-end
4.4.0
: P3 normal
: ---
Assigned To: Not yet assigned to anyone
:
Depends on:
Blocks: Wuninitialized
  Show dependency treegraph
 
Reported: 2009-04-28 02:23 UTC by David Fang
Modified: 2013-11-20 00:58 UTC (History)
3 users (show)

See Also:
Host:
Target:
Build:
Known to work: 4.5.0
Known to fail: 4.4.0
Last reconfirmed: 2009-11-19 12:22:23


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description David Fang 2009-04-28 02:23:53 UTC
g++-4.4 gives odd error about <anonymous> being uninitialized around a vector resize().

// test case: tc_uninit.cc
#include <vector>

struct A {
        double                  time;
        size_t                  id;

        A() { }         // uninitialized

};      

struct B {
        typedef std::vector<A>  array_type;
        array_type              array;

        void
        foo(void);
};      

void
B::foo(void) {
        array.resize(1);
}

% g++-4 -pipe -ansi -pedantic-errors -Wold-style-cast -Woverloaded-virtual -W -Wextra -Wall -Wundef -Wshadow -Wno-unused-parameter -Wpointer-arith -Wcast-qual -Wcast-align -Wconversion -Werror -std=c++0x -Wno-error=conversion -g -O3 -Wno-long-long -c tc_uninit.cc  -o tc_uninit.o

cc1plus: warnings being treated as errors
tc_uninit.cc: In member function 'void B::foo()':
tc_uninit.cc:21: error: '<anonymous>' is used uninitialized in this function
{standard input}:unknown:Undefined local symbol L__Znwm$stub
{standard input}:unknown:Undefined local symbol L__ZdlPv$stub
{standard input}:unknown:Undefined local symbol L__ZSt20__throw_length_errorPKc$stub

Observations: while trying to reduce, when either member of A is removed, the diagnostic ceases and successfully compiles.

Aside, is there a good way to suppress those unhelpful stdin diagnostics?

build/host: powerpc-apple-darwin8
Comment 1 David Fang 2009-04-28 02:31:22 UTC
Should probably compare with set of reports blocking PR 24639...
Comment 2 Andrew Pinski 2009-04-28 22:19:20 UTC
Works on the trunk.
Comment 3 Manuel López-Ibáñez 2009-11-19 12:22:23 UTC
The best we can do is to add this testcase to GCC 4.5 and close this as FIXED in mainline. These kind of fixes are typically not easy to backport.
Comment 4 Jeffrey A. Law 2013-11-20 00:58:08 UTC
Per comments #2 and #3.