#5251 closed Bugs (wontfix)
boost graph seg faults inside gdb
Reported by: | Owned by: | Andrew Sutton | |
---|---|---|---|
Milestone: | To Be Determined | Component: | graph |
Version: | Boost 1.42.0 | Severity: | Problem |
Keywords: | graph num_edges | Cc: |
Description
I have a class with a boost graph member variable in it.
When I call a method from within gdb, to get the number of edges of a graph, I get a segmentation fault.
I'm attaching a standalone code that reproduces it:
- Enter GDB
- Set a breakpoint on line number 34
- From within GDB execute the following: (a) p wrapper.dummy_.nedges() (b) p dummy.nedges()
3a is fine, prints out 0 as it should be. The graph is empty.
3b seg faults though...
This is the resulting call stack:
#0 0x08049b90 in std::_List_const_iterator<boost::list_edge<void*, boost::property<boost::edge_bundle_t, int, boost::no_property> > >::operator++ (this=0xbffff6fc) at /usr/include/c++/4.4/bits/stl_list.h:223
#1 0x08049427 in std::distance<std::_List_const_iterator<boost::list_edge<void*, boost::property<boost::edge_bundle_t, int, boost::no_property> > > > (first=..., last=...) at /usr/include/c++/4.4/bits/stl_iterator_base_funcs.h:79
#2 0x08048ea3 in std::distance<std::_List_const_iterator<boost::list_edge<void*, boost::property<boost::edge_bundle_t, int, boost::no_property> > > > (first=..., last=...) at /usr/include/c++/4.4/bits/stl_iterator_base_funcs.h:114
#3 0x08048c12 in std::list<boost::list_edge<void*, boost::property<boost::edge_bundle_t, int, boost::no_property> >, std::allocator<boost::list_edge<void*, boost::property<boost::edge_bundle_t, int, boost::no_property> > > >::size (this=0xbffff7c4) at /usr/include/c++/4.4/bits/stl_list.h:805
#4 0x08048a3a in boost::num_edges<boost::detail::adj_list_gen<boost::adjacency_list<boost::listS, boost::listS, boost::undirectedS, int, int, boost::no_property, boost::listS>, boost::listS, boost::listS, boost::undirectedS, boost::property<boost::vertex_bundle_t, int, boost::no_property>, boost::property<boost::edge_bundle_t, int, boost::no_property>, boost::no_property, boost::listS>::config> (g_=...) at /usr/include/boost/graph/detail/adjacency_list.hpp:978
#5 0x08048865 in dummy_class::nedges (this=0xbffff7c4) at graph.cxx:17
#6 <function called from gdb>
#7 dummy_method () at graph.cxx:34
#8 0x080488ea in main (argc=3, argv=0xbffff914) at graph.cxx:43
This is preventing us from using the graph reliably.
Using Ubuntu 10.10 with Boost 1.42.0 and G++ 4.4.4.
Reproduceable on Ubuntu 9.10 as well.
Attachments (1)
Change History (5)
by , 12 years ago
Attachment: | graph.2.cxx added |
---|
comment:1 by , 12 years ago
Does this problem happen outside the debugger? Also, could you please try compiling with -D_GLIBCXX_DEBUG
and see if that changes the behavior at all?
comment:2 by , 12 years ago
Yes, I've seen it crash outside the debugger before, when printing the number of edges. Even though I cannot make it happen with that specific sample of code.
Your suggestion does not change the behavior.
Here is a piece of info that may provide some clue. I'm using g++ 4.4 for the above. This generates a few warnings concerning deprecated interfaces in boost. That may be related to the problem. I tried using g++ 4.2 and it all works fine. With g++ 4.2 all the compilation warnings related to deprecated interfaces in boost are gone as well.
comment:3 by , 12 years ago
Resolution: | → wontfix |
---|---|
Status: | new → closed |
I tried it using GCC 4.1.2, and it also fails; it works using GCC 3.4.6 and GCC 4.6.0 20101120 (you can't print dummy.nedges()
, but dummy
is reasonable). The list of edges in dummy
ends up being circular, leading to an infinite loop. Printing out the two values listed in the bug report within the program works fine (both returning 0), but it does loop in the debugger. I'm not sure what I can do about the problem, though; it is unlikely to be a BGL problem when everything works in the code and passes valgrind and _GLIBCXX_DEBUG
. I'm going to close it as "wontfix" since I suspect it's not a BGL issue, even though I can reproduce it myself.
sample code to reproduce the bug