id summary reporter owner description type status milestone component version severity resolution keywords cc 9134 "Code that uses BOOST_THROW_EXCEPTION produces a lot of ""result may be used uninitialized (...)"" warnings in certain conditions" Adam Romanek Emil Dotchevski "The problem appears when using g++ with `-Wuninitialized -fno-exceptions -O3` flags. Given a simple test: {{{ #include int main() { return boost::lexical_cast(""""); } }}} when compiled using g++ v4.6.3 produces the following output: {{{ $ g++ test.cpp -Iboost -fno-exceptions -Wuninitialized -O3 -c In file included from test.cpp:1:0: boost/boost/lexical_cast.hpp: In static member function ‘static Target boost::detail::lexical_cast_do_cast::lexical_cast_impl(const Source&) [with Target = int, Source = const char*]’: boost/boost/lexical_cast.hpp:2353:24: warning: ‘result’ may be used uninitialized in this function [-Wuninitialized] }}} Please note that this problem appears only when using `-O3` optimization level. One way of fixing this issue is to add `BOOST_ATTRIBUTE_NORETURN` to `boost::throw_exception()` declaration in `boost/throw_exception.hpp`, as shown in the attached patch. It should be safe to do so, as the documentation of `boost::throw_exception()` says that: > (...) Callers of throw_exception are allowed to assume that the function never returns (...) This solves the issue completely." Patches new To Be Determined exception Boost 1.54.0 Problem