Boost logo

Boost Users :

From: Christopher D. Russell (cdr_at_[hidden])
Date: 2004-12-10 09:38:33


This isn't a question but rather a quick report for my future reference - I
need to circle back and try to characterize this problem more fully when I'm
not on deadline and can run some additional tests with Boost 1.32.0.

Environment:

- MS 7.1 compiler w/their STL distribution
- Boost 1.31.0 (my client doesn't want to update to 1.32.0 until after this
release)

Summary:

boost::variant registered as an internal edge property map member on a BGL
graph causes the resultant graph to be inaccessible due to what appears to be
incorrect initialization of both the internal vertex and edge property maps.
I SUSPECT THAT THE ROOT CAUSE OF THIS CAN BE TRACKED BACK TO A MS 7.1
COMPILER BUG due to the fact that attempts to compile my test code results in
either of (a) an C1001 Internal Compiler Error (b) a error-free compile and a
completely screwed runtime.

Details:

The boost::variant in question is bounded by several unique specializations
of a fully-specialized class. As follows:

// pseudocode
class A;
class B;
class C;

template <typename tail_T, typename head_T> class edge_exeuctor
{};

template <> class edge_executor<A, B>;
template <> class edge_exeuctor<A,C>;
tempalte <> class edge_exeuctor<B,C>;
template <> class edge_executor<B,A>;
tempalte <> class edge_executor<C,A>;
template <> class edge_executor<C,B>;

typedef boost::variant<
edge_executor<A,B>,
edge_executor<A,C>,
edge_executor<B,C>,
edge_executor<B,A>,
edge_executor<C,A>,
edge_executor<C,B> > variant_edge_t;

The graph in question is declared as:

enum vertex_foo_property_t { vertex_foo_property = 801 };
enum edge_foo_property_t {edge_foo_property = 802 };

BOOST_INSTALL_PROPERTY(vertex, foo_property);
BOOST_INSTALL_PROPERTY(edge, foo_property);

typedef property<vertex_foo_property, int, boost::property<vertex_color_t,
default_color_type> > vertex_properties_t;

typedef property<edge_foo_property, variant_edge_t> edge_properties_t;

typedef adjacency_list<listS, listS, bidirectionalS, vertex_properties_t,
edge_properties_t> graph_t;
typedef graph_traits<graph_t>::edges_size_type edges_size_t;

Failure:

// THE TEST CODE WILL NOT ALWAYS COMPILE W/MS 7.1
// HALF THE TIME IT BOMBS W/C1001 INTERNAL COMPILER ERROR
// when it does compile, no errors are reported by the following runtime
behavior is observed

graph_t g;
edges_size_t edge_count = num_edges(g); // <- protection fault

// stepping into num_edges in a debug build reveals that both vertex and edge
property maps point to uninitialized memory (0xcdcdcdcd)
// removing variant_edge_t from edge_properties_t and replacing with an int
works as expected...

----
- Chris

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net