Subject: Re: [Boost-bugs] [Boost C++ Libraries] #5706: Gcc 4.6 warnings for Boost Graph
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2013-12-17 16:24:36
#5706: Gcc 4.6 warnings for Boost Graph
--------------------------------------+------------------------------------
Reporter: ramon.casellas@⦠| Owner: asutton
Type: Feature Requests | Status: closed
Milestone: Boost 1.48.0 | Component: graph
Version: Boost Development Trunk | Severity: Optimization
Resolution: wontfix | Keywords: uninitialized warnings
--------------------------------------+------------------------------------
Comment (by Timmie Smith <timmie@â¦>):
The warnings are still displayed using gcc 4.7.2 -O3 on Fedora.
In boost/graph/detail/adj_list_edge_iterator.hpp
boost::detail::adj_list_edge_iterator::operator!= is implemented as
{{{
inline bool operator!=(const self& x) const {
return vCurr != x.vCurr
|| (vCurr != vEnd
&& edges BOOST_GRAPH_MEMBER first != x.edges
BOOST_GRAPH_MEMBER first);
}}}
The unconditional access of this->edges.first and x.edges.first is
incorrect in my opinion, as the edges data member in either instance may
be uninitialized.
Patching the operator to first check if the edges data members are
initialized eliminates the warning and the evaluation should short circuit
in the case that they aren't, eliminating the access of edges.first if
edges isn't initialized.
{{{
inline bool operator!=(const self& x) const {
return vCurr != x.vCurr
|| (vCurr != vEnd
&& edges && x.edges && edges BOOST_GRAPH_MEMBER first !=
x.edges BOOST_GRAPH_MEMBER first);
}}}
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/5706#comment:2> 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:15 UTC