Opened 11 years ago

Last modified 6 years ago

#5706 reopened Feature Requests

Gcc 4.6 warnings for Boost Graph

Reported by: ramon.casellas@… Owned by: Andrew Sutton
Milestone: Boost 1.56.0 Component: graph
Version: Boost Development Trunk Severity: Optimization
Keywords: uninitialized warnings Cc:

Description

Dear authors,

Compiling our applications with newest gcc-4.6- some warnings regarding boost graph are displayed. We would appreciate if you could silence them.

Please find below gcc output

Ubuntu oneiric 64 bits boost 1.47/ trunk , gcc Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.6.1/lto-wrapper Target: x86_64-linux-gnu

/adnet/boost-1.47.0/include/boost/graph/detail/adj_list_edge_iterator.hpp: In member function ‘void boost::vec_adj_list_impl<Graph, Config, Base>::copy_impl(const boost::vec_adj_list_impl<Graph, Config, Base>&) [with Graph = boost::adjacency_list<boost::vecS, boost::vecS, boost::directedS, pce::te::node_te_attributes, pce::te::link_te_attributes, pce::te::graph_te_attributes, boost::listS>, Config = boost::detail::adj_list_gen<boost::adjacency_list<boost::vecS, boost::vecS, boost::directedS, pce::te::node_te_attributes, pce::te::link_te_attributes, pce::te::graph_te_attributes, boost::listS>, boost::vecS, boost::vecS, boost::directedS, boost::property<boost::vertex_bundle_t, pce::te::node_te_attributes, boost::no_property>, boost::property<boost::edge_bundle_t, pce::te::link_te_attributes, boost::no_property>, pce::te::graph_te_attributes, boost::listS>::config, Base = boost::directed_graph_helper<boost::detail::adj_list_gen<boost::adjacency_list<boost::vecS, boost::vecS, boost::directedS, pce::te::node_te_attributes, pce::te::link_te_attributes, pce::te::graph_te_attributes, boost::listS>, boost::vecS, boost::vecS, boost::directedS, boost::property<boost::vertex_bundle_t, pce::te::node_te_attributes, boost::no_property>, boost::property<boost::edge_bundle_t, pce::te::link_te_attributes, boost::no_property>, pce::te::graph_te_attributes, boost::listS>::config>, boost::vec_adj_list_impl<Graph, Config, Base> = boost::vec_adj_list_impl<boost::adjacency_list<boost::vecS, boost::vecS, boost::directedS, pce::te::node_te_attributes, pce::te::link_te_attributes, pce::te::graph_te_attributes, boost::listS>, boost::detail::adj_list_gen<boost::adjacency_list<boost::vecS, boost::vecS, boost::directedS, pce::te::node_te_attributes, pce::te::link_te_attributes, pce::te::graph_te_attributes, boost::listS>, boost::vecS, boost::vecS, boost::directedS, boost::property<boost::vertex_bundle_t, pce::te::node_te_attributes, boost::no_property>, boost::property<boost::edge_bundle_t, pce::te::link_te_attributes, boost::no_property>, pce::te::graph_te_attributes, boost::listS>::config, boost::directed_graph_helper<boost::detail::adj_list_gen<boost::adjacency_list<boost::vecS, boost::vecS, boost::directedS, pce::te::node_te_attributes, pce::te::link_te_attributes, pce::te::graph_te_attributes, boost::listS>, boost::vecS, boost::vecS, boost::directedS, boost::property<boost::vertex_bundle_t, pce::te::node_te_attributes, boost::no_property>, boost::property<boost::edge_bundle_t, pce::te::link_te_attributes, boost::no_property>, pce::te::graph_te_attributes, boost::listS>::config> >]’:
/adnet/boost-1.47.0/include/boost/graph/detail/adj_list_edge_iterator.hpp:95:84: warning: ‘*((void*)& ei_end +32)’ may be used uninitialized in this function [-Wuninitialized]
/adnet/boost-1.47.0/include/boost/graph/detail/adjacency_list.hpp:2128:27: note: ‘*((void*)& ei_end +32)’ was declared here
/adnet/boost-1.47.0/include/boost/graph/detail/adj_list_edge_iterator.hpp:70:9: warning: ‘*((void*)(& ei)+48).__gnu_cxx::__normal_iterator<boost::detail::sep_<long unsigned int, boost::property<boost::edge_bundle_t, pce::te::link_te_attributes, boost::no_property> >*, std::vector<boost::detail::sep_<long unsigned int, boost::property<boost::edge_bundle_t, pce::te::link_te_attributes, boost::no_property> >, std::allocator<boost::detail::sep_<long unsigned int, boost::property<boost::edge_bundle_t, pce::te::link_te_attributes, boost::no_property> > > > >::_M_current’ may be used uninitialized in this function [-Wuninitialized]
/adnet/boost-1.47.0/include/boost/graph/detail/adjacency_list.hpp:2128:23: note: ‘*((void*)(& ei)+48).__gnu_cxx::__normal_iterator<boost::detail::sep_<long unsigned int, boost::property<boost::edge_bundle_t, pce::te::link_te_attributes, boost::no_property> >*, std::vector<boost::detail::sep_<long unsigned int, boost::property<boost::edge_bundle_t, pce::te::link_te_attributes, boost::no_property> >, std::allocator<boost::detail::sep_<long unsigned int, boost::property<boost::edge_bundle_t, pce::te::link_te_attributes, boost::no_property> > > > >::_M_current’ was declared here
/adnet/boost-1.47.0/include/boost/graph/detail/adjacency_list.hpp:2117:19: warning: ‘*((void*)(& ei)+32).__gnu_cxx::__normal_iterator<boost::detail::sep_<long unsigned int, boost::property<boost::edge_bundle_t, pce::te::link_te_attributes, boost::no_property> >*, std::vector<boost::detail::sep_<long unsigned int, boost::property<boost::edge_bundle_t, pce::te::link_te_attributes, boost::no_property> >, std::allocator<boost::detail::sep_<long unsigned int, boost::property<boost::edge_bundle_t, pce::te::link_te_attributes, boost::no_property> > > > >::_M_current’ may be used uninitialized in this function [-Wuninitialized]

Thank you in advance and best regards

R.

Change History (5)

comment:1 by Jeremiah Willcock, 11 years ago

Resolution: wontfix
Status: newclosed

It looks like you are hitting http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47679; it is not a problem with Boost at all, although there is a workaround to silence the warnings at that link.

comment:2 by Timmie Smith <timmie@…>, 9 years ago

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);

comment:3 by Timmie Smith <timmie@…>, 9 years ago

Milestone: Boost 1.48.0Boost 1.56.0
Resolution: wontfix
Status: closedreopened

comment:4 by Murray Cumming <murrayc@…>, 6 years ago

Is this still a problem?

comment:5 by timmie@…, 6 years ago

It looks like this is still a problem, yes. The file has not been modified since Boost 1.56.

Note: See TracTickets for help on using tickets.