Subject: [Boost-bugs] [Boost C++ Libraries] #4369: function::function_base potential uninitialized data member
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2010-06-23 19:24:27
#4369: function::function_base potential uninitialized data member
------------------------------------------------------+---------------------
Reporter: Steve Hawkes <steve.hawkes@â¦> | Owner: dgregor
Type: Bugs | Status: new
Milestone: Boost 1.44.0 | Component: function
Version: Boost Development Trunk | Severity: Problem
Keywords: function_base |
------------------------------------------------------+---------------------
When running the Klocwork static code analysis tool on some code that uses
Boost, Klocwork reported the following potential issue in Boost.Function
(note that this is for boost 1_36_0, but the latest trunk code appears to
have the same issue):
----
'this->functor.const_obj_ptr' is not initialized in this
constructor.[[BR]]
function_base.hpp:576: 'this->functor.const_obj_ptr' is used, but is
uninitialized.[[BR]]
{{{
class function_base
{
public:
function_base() : vtable(0) { }
...
public: // should be protected, but GCC 2.95.3 will fail to allow access
detail::function::vtable_base* vtable;
mutable detail::function::function_buffer functor;
};
}}}
----
A similar error is reported for each field in the functor data member (a
function_buffer union). Wouldn't it be appropriate to initialize the
functor data member to a default value, as is done with the vtable data
member?
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/4369> Boost C++ Libraries <http://www.boost.org/> Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:03 UTC