This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
obviously bogus 'might be used uninitialized' warning, g++ 3.4.3
- From: ben f <benomatic42 at yahoo dot com>
- To: gcc-help at gcc dot gnu dot org
- Date: Sun, 22 May 2005 19:15:03 -0700 (PDT)
- Subject: obviously bogus 'might be used uninitialized' warning, g++ 3.4.3
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
openbsd.
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;
strvec.resize(10);
return (0);
}
$ eg++ -c -O2 -Wall -Werror t.cc
/usr/local/lib/gcc/i386-unknown-openbsd3.6/3.4.3/../../../../include/c++/3.4.3/bits/stl_uninitialized.h:
In member function `void std::vector<_Tp,
_Alloc>::_M_fill_insert(__gnu_cxx::__normal_iterator<typename
_Alloc::pointer, std::vector<_Tp, _Alloc> >, size_t,
const _Tp&) [with _Tp = std::string, _Alloc =
std::allocator<std::string>]':
/usr/local/lib/gcc/i386-unknown-openbsd3.6/3.4.3/../../../../include/c++/3.4.3/bits/stl_uninitialized.h:82:
warning: '__cur' might be used uninitialized in this
function
/usr/local/lib/gcc/i386-unknown-openbsd3.6/3.4.3/../../../../include/c++/3.4.3/bits/stl_uninitialized.h:82:
warning: '__cur' might be used uninitialized in this
function
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.
ben
__________________________________
Do you Yahoo!?
Make Yahoo! your home page
http://www.yahoo.com/r/hs