This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/39936] New: -Wuninitialized false positive with unhelpful diagnostic


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


-- 
           Summary: -Wuninitialized false positive with unhelpful diagnostic
           Product: gcc
           Version: 4.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: fang at csl dot cornell dot edu


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]