Boost logo

Boost Users :

Subject: [Boost-users] [graph] Problem with vertex initialization in boost::add_vertex()
From: Philipp Klaus Krause (pkk_at_[hidden])
Date: 2012-04-05 06:28:10


I have graph as follows:

struct cfg_node
{
  iCode *ic;
  operand_map_t operands;
  std::set<var_t> alive;
  std::set<var_t> dying;
};

typedef boost::adjacency_list<boost::vecS, boost::vecS,
boost::bidirectionalS, cfg_node> cfg_t;

And a fragment of code:

wassertl (!boost::num_vertices(cfg), "CFG non-empty before creation.");
for (ic = start_ic, i = 0, j = 0; ic; ic = ic->next, i++)
      {
        boost::add_vertex(cfg);
        wassertl (cfg[i].alive.empty(), "Alive set non-empty upon
creation.");

Nothing inside the loop add or deletes vertices or changes the alive
members.

The code works fine on Linux, but I got bug reports from Windows users.
For them the assertion in the loop triggers (and an attempt to insert
something into alive later segfaults).
So I have two questions:

What could be the cause of this problem? Has it been encountered before?

Is the approach of using cfg[i] to get the vertex still correct? I've
used this for some time, but I can't find it in current boost documentation.

Philipp


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