[Bug tree-optimization/59970] Bogus warnings at low optimization levels
matt at godbolt dot org
gcc-bugzilla@gcc.gnu.org
Fri Apr 25 01:36:00 GMT 2014
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59970
Matt Godbolt <matt at godbolt dot org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |matt at godbolt dot org
--- Comment #2 from Matt Godbolt <matt at godbolt dot org> ---
FWIW I stumbled over what I believe is the same issue inside the boost v1.55.0
lexical_cast implementation. That also only shows up as a "possible
uninitialized" at -Og optimization only. I can provide preprocessed source if
necessary (though, being boost, it's 80k lines, ugh) but if you have gcc4.9.0
and boost 1.55 available:
$ cat test.cc
#include <boost/lexical_cast.hpp>
int test() { return boost::lexical_cast<int>("1"); }
$ g++ -Wall -Wextra -Og -c test.cc
test.cc: In function ‘int test()’:
test.cc:4:40: warning: ‘result’ may be used uninitialized in this function
[-Wmaybe-uninitialized]
return boost::lexical_cast<int>("1");
The relevant lines in boost itself appear to be
http://svn.boost.org/svn/boost/tags/release/Boost_1_55_0/boost/lexical_cast.hpp
lines 2365-2377 where the "result" is optionally initialized.
I'll also submit this to the boost developers in case they have some ideas.
More information about the Gcc-bugs
mailing list