Boost logo

Boost :

From: Paolo Fosser (pfosser_at_[hidden])
Date: 2002-05-24 13:46:53

Hi to everybody,
   first of all I beg pardon if my English isn't much good: I'm Italian!

I'm working with gcc 3.0.1 on a Linux Mandrake sys with kernel 2.4.8.
The problem I'm having is that the second call of read_graphviz() in the
same program causes a Segmentation fault.

Hoping it will be useful in order to spot the trouble, I did some
"debugging" on yyparse() from file graphviz_graph_parser.cpp.

I found out that the Segmentation fault is caused by the line commented
with // <<<< in the following code snippet


case 29:
#line 318 "graphviz_parser.y"
    graphviz::Vertex* temp =

    graphviz::current_vertex = *temp;
                            NODE_A); // <<<<
    delete temp;
    yyval.i = 0;


Having a look at (and tampering with) graphviz::set_attribute()


static void set_attribute(Subgraph& g,
                          AttrState s, bool clear_attribute = true) {

  typedef Subgraph Graph;
  switch ( s ) {
// ...
      case NODE_A:
          boost::property_map<Graph, boost::vertex_attribute_t>::type
            va = boost::get(boost::vertex_attribute, g); //va[v]
          set_attribute(va[current_vertex], attributes);
// ...



I isolated the access violation in the call to (a different)

    static void set_attribute(GraphvizAttrList& p,
                              const GraphvizAttrList& attr) {
      GraphvizAttrList::const_iterator i, end;
      for ( i=attr.begin(), end=attr.end(); i!=end; ++i)

More precisely, execution breaks down at the first
p[i->first]=i->second; . I checked attr and its content is correct.
Hence the problem seems to be p, that is va[current_vertex], that is the
content of the location pointed to by yyvsp[-1].ptr (see first snippet).

I hope my analisys was correct.

I'd like to point out that my code calls read_graphviz() two times on
the same graph. The first time all is OK, while the second call causes
the segmentation fault.

Many thanks to anyone who will spend their time in helping me. This is
important to me because I'm using the library for my thesis.


Boost list run by bdawes at, gregod at, cpdaniel at, john at