Opened 18 years ago

Closed 18 years ago

#272 closed Bugs (Works For Me)

undirected adjacency_matrix example segfaults at print_graph

Reported by: burnce Owned by: jsiek
Milestone: Component: graph
Version: None Severity:
Keywords: Cc:

Description

Example 2 from 

http://www.boost.org/libs/graph/doc/adjacency_matrix.html 

creates a segfault in the second to last line 

       boost::print_graph(ug, name);

Details follow:

Program received signal SIGSEGV, Segmentation fault.
0x0804a276 in bool
boost::detail::get_edge_exists<char>(char const&, ...)
(edge_proxy=@0xc804bbe9) at adjacency_matrix.hpp:84
/usr/include/boost/graph/adjacency_matrix.hpp:84:2923:beg:0x804a276
(gdb) up
#1  0x0804ab6b in
boost::detail::undir_adj_matrix_out_edge_iter<unsigned,
__gnu_cxx::__normal_iterator<char*, std::vector<char,
std::allocator<char> > >, unsigned,
boost::detail::matrix_edge_desc_impl<boost::undirected_tag,
unsigned> >::dereference() const (this=0xbfffead0) at
adjacency_matrix.hpp:228
(gdb) up
#2  0x0804ab0c in
dereference<boost::detail::undir_adj_matrix_out_edge_iter<size_t,
__gnu_cxx::__normal_iterator<char*, std::vector<char,
std::allocator<char> > >, size_t,
boost::detail::matrix_edge_desc_impl<boost::undirected_tag,
size_t> > > (f=@0xbfffead0) at iterator_facade.hpp:341
(gdb) up
#3  0x0804aae2 in
boost::iterator_facade<boost::detail::undir_adj_matrix_out_edge_iter<unsigned,
__gnu_cxx::__normal_iterator<char*, std::vector<char,
std::allocator<char> > >, unsigned,
boost::detail::matrix_edge_desc_impl<boost::undirected_tag,
unsigned> >,
boost::detail::matrix_edge_desc_impl<boost::undirected_tag,
unsigned>, boost::random_access_traversal_tag,
boost::detail::matrix_edge_desc_impl<boost::undirected_tag,
unsigned>, int>::operator*() const (this=0xbfffead0) at
iterator_facade.hpp:442
(gdb) up
#4  0x0804aa7b in
boost::filter_iterator<boost::detail::does_edge_exist,
boost::detail::undir_adj_matrix_out_edge_iter<unsigned,
__gnu_cxx::__normal_iterator<char*, std::vector<char,
std::allocator<char> > >, unsigned,
boost::detail::matrix_edge_desc_impl<boost::undirected_tag,
unsigned> > >::satisfy_predicate() (this=0xbfffead0) at
filter_iterator.hpp:102
/usr/include/boost/iterator/filter_iterator.hpp:102:2993:beg:0x804aa7b
(gdb) up
#5  0x0804a9fd in filter_iterator (this=0xbfffead0,
f={<No data fields>},
x={<iterator_adaptor<boost::detail::undir_adj_matrix_out_edge_iter<unsigned
int, __gnu_cxx::__normal_iterator<char*,
std::vector<char, std::allocator<char> > >, unsigned
int,
boost::detail::matrix_edge_desc_impl<boost::undirected_tag,
unsigned int> >,__gnu_cxx::__normal_iterator<char*,
std::vector<char, std::allocator<char> >
>,boost::detail::matrix_edge_desc_impl<boost::undirected_tag,
unsigned
int>,boost::use_default,boost::detail::matrix_edge_desc_impl<boost::undirected_tag,
unsigned int>,int>> =
{<iterator_facade<boost::detail::undir_adj_matrix_out_edge_iter<unsigned
int, __gnu_cxx::__normal_iterator<char*,
std::vector<char, std::allocator<char> > >, unsigned
int,
boost::detail::matrix_edge_desc_impl<boost::undirected_tag,
unsigned int>
>,boost::detail::matrix_edge_desc_impl<boost::undirected_tag,
unsigned
int>,boost::random_access_traversal_tag,boost::detail::matrix_edge_desc_impl<boost::undirected_tag,
unsigned int>,int>> = {<No data fields>}, m_iterator =
{<iterator<std::random_access_iterator_tag,char,int,char*,char&>>
= {<No data fields>}, _M_current = 0x804d050 ""}},
m_src = 0, m_inc = 3221220248, m_targ = 0, m_n = 6},
end={<iterator_adaptor<boost::detail::undir_adj_matrix_out_edge_iter<unsigned
int, __gnu_cxx::__normal_iterator<char*,
std::vector<char, std::allocator<char> > >, unsigned
int,
boost::detail::matrix_edge_desc_impl<boost::undirected_tag,
unsigned int> >,__gnu_cxx::__normal_iterator<char*,
std::vector<char, std::allocator<char> >
>,boost::detail::matrix_edge_desc_impl<boost::undirected_tag,
unsigned
int>,boost::use_default,boost::detail::matrix_edge_desc_impl<boost::undirected_tag,
unsigned int>,int>> =
{<iterator_facade<boost::detail::undir_adj_matrix_out_edge_iter<unsigned
int, __gnu_cxx::__normal_iterator<char*,
std::vector<char, std::allocator<char> > >, unsigned
int,
boost::detail::matrix_edge_desc_impl<boost::undirected_tag,
unsigned int>
>,boost::detail::matrix_edge_desc_impl<boost::undirected_tag,
unsigned
int>,boost::random_access_traversal_tag,boost::detail::matrix_edge_desc_impl<boost::undirected_tag,
unsigned int>,int>> = {<No data fields>}, m_iterator =
{<iterator<std::random_access_iterator_tag,char,int,char*,char&>>
= {<No data fields>}, _M_current = 0x804d065 ""}},
m_src = 0, m_inc = 3221220260, m_targ = 0, m_n = 6}) at
filter_iterator.hpp:61
(gdb) up
#6  0x08049f60 in
std::pair<boost::adjacency_matrix<boost::undirectedS,
boost::no_property, boost::no_property,
boost::no_property, std::allocator<bool>
>::out_edge_iterator,
boost::adjacency_matrix<boost::undirectedS,
boost::no_property, boost::no_property,
boost::no_property, std::allocator<bool>
>::out_edge_iterator>
boost::out_edges<boost::no_property,
boost::no_property, boost::no_property,
std::allocator<bool>
>(boost::adjacency_matrix<boost::undirectedS,
boost::no_property, boost::no_property,
boost::no_property, std::allocator<bool>
>::vertex_descriptor,
boost::adjacency_matrix<boost::undirectedS,
boost::no_property, boost::no_property,
boost::no_property, std::allocator<bool> > const&)
(u=0, g_=@0xbfffed70) at adjacency_matrix.hpp:529
(gdb) up
#7  0x08049cc7 in void
boost::print_graph_dispatch<boost::adjacency_matrix<boost::undirectedS,
boost::no_property, boost::no_property,
boost::no_property, std::allocator<bool> >, char
const*>(boost::adjacency_matrix<boost::undirectedS,
boost::no_property, boost::no_property,
boost::no_property, std::allocator<bool> > const&, char
const*, boost::undirected_tag) (G=@0xbfffed70,
name=0x804b0fc "ABCDEF") at graph_utility.hpp:201
(gdb) up
#8  0x08048e28 in void
boost::print_graph<boost::adjacency_matrix<boost::undirectedS,
boost::no_property, boost::no_property,
boost::no_property, std::allocator<bool> >, char
const*>(boost::adjacency_matrix<boost::undirectedS,
boost::no_property, boost::no_property,
boost::no_property, std::allocator<bool> > const&, char
const*) (G=@0xbfffed70, name=0x804b0fc "ABCDEF") at
graph_utility.hpp:211
(gdb) up
#9  0x08048a9a in main () at undirected_adj_matrix.cc:25



Change History (3)

comment:1 by burnce, 18 years ago

Logged In: YES 
user_id=1044311

Using the "acency_matrix.cpp" example file in the
documentation I get this error on various linux versions and
various architectures.

comment:2 by Douglas Gregor, 18 years ago

Logged In: YES 
user_id=249098

I can no longer duplicate this bug. Can anyone else? If not, I'll close it.

comment:3 by Douglas Gregor, 18 years ago

Status: assignedclosed
Note: See TracTickets for help on using tickets.