Boost logo

Ublas :

From: Paul C. Leopardi (paul.leopardi_at_[hidden])
Date: 2008-03-15 09:52:06


Hi all,
I'm getting strange results (below) with iterators in storage_sparse.hpp and
was wondering if this was a know issue in gcc 4.3.0?
Thanks

(Program compiled on x86_64 with full debugging, NDEBUG undefined)

> g++ -v
Using built-in specs.
Target: x86_64-unknown-linux-gnu
Configured
with: ../gcc-4.3.0/configure --enable-threads=posix --prefix=/opt/gcc-4.3.0 --enable-languages=all --enable-checking=release --enable-ssp --disable-libssp --with-system-zlib -with-gmp=/usr/local --with-mpfr=/usr/local --enable-shared --enable-__cxa_atexit --enable-libstdcxx-allocator=new --without-system-libunwind
Thread model: posix
gcc version 4.3.0 (GCC)

> make
if
g++ -DHAVE_CONFIG_H -I. -I. -I.. -Wall -ansi -O0 -finline-limit=400 -g3 -D_GLUCAT_USE_TR1_UNORDERED_MAP -fno-check-new -fexceptions -MT
peg11.o -MD -MP -MF ".deps/peg11.Tpo" -c -o peg11.o peg11.cpp; \
then mv -f ".deps/peg11.Tpo" ".deps/peg11.Po"; else rm -f ".deps/peg11.Tpo";
exit 1; fi
./test11
/bin/sh ../libtool --silent --tag=CXX --mode=link
g++ -Wall -ansi -O0 -finline-limit=400 -g3 -D_GLUCAT_USE_TR1_UNORDERED_MAP -fno-check-new -fexceptions -o
test11 peg11.o
> ./test11
A
  0

A
  1
Segmentation fault

Program received signal SIGSEGV, Segmentation fault.
0x0000000000439618 in std::less<unsigned long>::operator()
(this=0x7fff99b293a0, __x=@0x37ba3c0, __y=@0x7fff99b29410)
    
at /opt/gcc-4.3.0/lib/gcc/x86_64-unknown-linux-gnu/4.3.0/../../../../include/c++/4.3.0/bits/stl_function.h:230
230 { return __x < __y; }
(gdb) display __x
Disabling display 1 to avoid infinite recursion.
1: __x = (const long unsigned int &) @0x37ba3c0: Cannot access memory at
address 0x37ba3c0
(gdb) display __y
2: __y = (const long unsigned int &) @0x7fff99b29410: 0
(gdb) bt
#0 0x0000000000439618 in std::less<unsigned long>::operator()
(this=0x7fff99b293a0, __x=@0x37ba3c0, __y=@0x7fff99b29410)
    
at /opt/gcc-4.3.0/lib/gcc/x86_64-unknown-linux-gnu/4.3.0/../../../../include/c++/4.3.0/bits/stl_function.h:230
#1 0x0000000000441abf in boost::numeric::ublas::detail::lower_bound<unsigned
long const*, unsigned long, std::less<unsigned long> >
(begin=@0x7fff99b293f0, end=@0x7fff99b293e8, t=@0x7fff99b29410,
    compare={<> = {<No data fields>}, <No data fields>})
at ../boost/numeric/ublas/storage_sparse.hpp:33
#2 0x0000000000446af9 in boost::numeric::ublas::compressed_matrix<float,
boost::numeric::ublas::basic_row_major<unsigned long, long>, 0ul,
boost::numeric::ublas::unbounded_array<unsigned long, std::allocator<unsigned
long> >, boost::numeric::ublas::unbounded_array<float, std::allocator<float>
> >::find2 (this=0x7fff99b29a50, rank=1, i=0, j=0, direction=1)
    at ../boost/numeric/ublas/matrix_sparse.hpp:3092
#3 0x0000000000446db2 in
boost::numeric::ublas::matrix_reference<boost::numeric::ublas::compressed_matrix<float,
boost::numeric::ublas::basic_row_major<unsigned long, long>, 0ul,
boost::numeric::ublas::unbounded_array<unsigned long, std::allocator<unsigned
long> >, boost::numeric::ublas::unbounded_array<float, std::allocator<float>
> > const>::find2 (
    this=0x7fff99b29680, rank=1, i=0, j=0)
at ../boost/numeric/ublas/matrix_expression.hpp:183
#4 0x0000000000449a35 in
boost::numeric::ublas::matrix_row<boost::numeric::ublas::compressed_matrix<float,
boost::numeric::ublas::basic_row_major<unsigned long, long>, 0ul,
boost::numeric::ublas::unbounded_array<unsigned long, std::allocator<unsigned
long> >, boost::numeric::ublas::unbounded_array<float, std::allocator<float>
> > const>::find (this=0x7fff99b29680,
    j=0) at ../boost/numeric/ublas/matrix_proxy.hpp:233
#5 0x0000000000449a7d in
boost::numeric::ublas::matrix_row<boost::numeric::ublas::compressed_matrix<float,
boost::numeric::ublas::basic_row_major<unsigned long, long>, 0ul,
boost::numeric::ublas::unbounded_array<unsigned long, std::allocator<unsigned
long> >, boost::numeric::ublas::unbounded_array<float, std::allocator<float>
> > const>::begin (this=0x7fff99b29680)
    at ../boost/numeric/ublas/matrix_proxy.hpp:433
#6 0x0000000000496e8b in
boost::numeric::ublas::sparse_prod<boost::numeric::ublas::compressed_matrix<float,
boost::numeric::ublas::basic_row_major<unsigned long, long>, 0ul,
boost::numeric::ublas::unbounded_array<unsigned long, std::allocator<unsigned
long> >, boost::numeric::ublas::unbounded_array<float, std::allocator<float>
> >, boost::numeric::ublas::compressed_matrix<float,
boost::numeric::ublas::basic_row_major<unsigned long, long>, 0ul,
boost::numeric::ublas::unbounded_array<unsigned long, std::allocator<unsigned
long> >, boost::numeric::ublas::unbounded_array<float, std::allocator<float>
> >, boost::nume---Type <return> to continue, or q <return> to quit---q
Quit
(gdb) frame 1
#1 0x0000000000441abf in boost::numeric::ublas::detail::lower_bound<unsigned
long const*, unsigned long, std::less<unsigned long> >
(begin=@0x7fff99b293f0, end=@0x7fff99b293e8, t=@0x7fff99b29410,
    compare={<> = {<No data fields>}, <No data fields>})
at ../boost/numeric/ublas/storage_sparse.hpp:33
33 if (begin == end || ! compare (*begin, t))
(gdb) display begin
3: begin = (const long unsigned int * const&) @0x7fff99b293f0: 0x37ba3c0
(gdb) display end
4: end = (const long unsigned int * const&) @0x7fff99b293e8: 0x631248
(gdb) display *end
5: *end = 1
(gdb) display *begin
Disabling display 6 to avoid infinite recursion.
6: *begin = Cannot access memory at address 0x37ba3c0