obviously bogus 'might be used uninitialized' warning, g++ 3.4.3

ben f benomatic42@yahoo.com
Mon May 23 02:15:00 GMT 2005

I have seen a series of bogus 'might be used 
uninitialized' errors, and tried to encapsulate them
into a simple example... unfortunately, the simplest
one shows the error occurring in stl header code, but
it's trivial to reproduce against g++ 3.4.3 on
I have no access to other g++ on other OSes atm.

the source:
$ cat t.cc
#include <string>
#include <vector>
int main(int argc, char *argv[])
    std::vector<std::string> strvec;
    return (0);

$ eg++ -c -O2 -Wall -Werror t.cc
In member function `void std::vector<_Tp,
_Alloc::pointer, std::vector<_Tp, _Alloc> >, size_t,
const _Tp&) [with _Tp = std::string, _Alloc =
warning: '__cur' might be used uninitialized in this
warning: '__cur' might be used uninitialized in this

adding -Wno-uninitialized gets rid of the problem,
as does removing -O2 (expectedly).

is this a real bug?  i spent some time searching
gcc's bugzilla and gcc/gcc-help/gcc-bugs mailing
lists, but so far have found nothing that looks
like this.  i'm building a 3.4.4 release as i type
to see if it exists there as well.

if it is real, what ought i do next?  please cc: any
responses to me directly.  thanks.


Do you Yahoo!? 
Make Yahoo! your home page 

More information about the Gcc-help mailing list