Bug 30633 - Weird uninit in Boost `add_edge'
Summary: Weird uninit in Boost `add_edge'
Status: RESOLVED INVALID
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.1.1
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-01-29 21:15 UTC by Scott L. Burson
Modified: 2007-02-06 01:01 UTC (History)
1 user (show)

See Also:
Host: x86_64-unknown-linux-gnu
Target: x86_64-unknown-linux-gnu
Build: x86_64-unknown-linux-gnu
Known to work:
Known to fail: 4.1.1
Last reconfirmed:


Attachments
Preprocessed source, as requested (gzipped) (160.59 KB, application/x-gunzip)
2007-02-06 00:21 UTC, Scott L. Burson
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Scott L. Burson 2007-01-29 21:15:02 UTC
Ran across this while using the Boost graph package.  Test program:

----------------------
#include <boost/graph/graph_traits.hpp>
#include <boost/graph/adjacency_list.hpp>


namespace boost {
    enum vertex_subgraph_t { vertex_subgraph };
    BOOST_INSTALL_PROPERTY(vertex, subgraph);
    enum vertex_order_t { vertex_order };
    BOOST_INSTALL_PROPERTY(vertex, order);
    enum edge_back_t { edge_back };
    BOOST_INSTALL_PROPERTY(edge, back);

};

typedef boost::property<boost::vertex_distance_t, int, 
	boost::property<boost::vertex_name_t, std::string,
	boost::property<boost::vertex_subgraph_t, int, 
	boost::property<boost::vertex_order_t, int > > > > VertexProperty;
typedef boost::property<boost::edge_back_t, bool > EdgeProperties;

typedef boost::adjacency_list< boost::vecS, boost::vecS, boost::bidirectionalS, VertexProperty, EdgeProperties > FlowLayoutGraph;

typedef boost::graph_traits< FlowLayoutGraph >::vertex_descriptor  vertex_descriptor;

void break_gcc(FlowLayoutGraph& m_graph, vertex_descriptor v1, vertex_descriptor v2)
{
    add_edge(v1, v2, m_graph);
}

--------------------------------

Obtain and unpack Boost 1.33.1.  Compile the above with a command like:

g++ -c -I/path/to/boost_1_33_1 -O -Wuninitialized filename.cpp

You should see a message complaining that `p$m_value' is used uninitialized.  (This is, as you probably already realize, a name generated internally by g++; there is no such variable in the source.)
Comment 1 Scott L. Burson 2007-02-05 23:40:29 UTC
I tried 4.1.2 RC1 -- the bug is still present.
Comment 2 Andrew Pinski 2007-02-05 23:47:06 UTC
>(This is, as you probably already realize, a name generated internally by g++;
> there is no such variable in the source.)
The name is generated internally by g++ but it is really p.m_value which was actually already fixed in 4.1.2 (PR 14329) as I fixed it :).
Can you paste the warning message that 4.1.2RC1 gives?

Can you attach the preprocessed source?
Comment 3 Scott L. Burson 2007-02-06 00:17:14 UTC
Actually, I didn't look closely enough; the error generated by 4.1.2 RC1 is different:

/usr/local/gcc-4.1.2/lib/gcc/i386-pc-solaris2.11/4.1.2/../../../../include/c++/4.1.2/ext/new_allocator.h: In function void break_gcc(FlowLayoutGraph&, vertex_descriptor, vertex_descriptor):
/usr/local/gcc-4.1.2/lib/gcc/i386-pc-solaris2.11/4.1.2/../../../../include/c++/4.1.2/ext/new_allocator.h:104: warning: p.boost::property<boost::edge_back_t, bool, boost::no_property>::m_value is used uninitialized in this function
Comment 4 Scott L. Burson 2007-02-06 00:21:18 UTC
Created attachment 13010 [details]
Preprocessed source, as requested (gzipped)
Comment 5 Andrew Pinski 2007-02-06 00:34:32 UTC
This is a true warning.
With the mainline we get an extra note:
boost_1_33_1/boost/graph/detail/adjacency_list.hpp:2116: note: 'p.boost::property<boost::edge_back_t, bool, boost::no_property>::m_value' was declared here

That was added for fixing PR 17506.

which shows that this is a bug in boost's headers.
Comment 6 Scott L. Burson 2007-02-06 01:01:50 UTC
Ah, very good.  Thanks for taking a look at this.