simongog / sdsl-lite

Succinct Data Structure Library 2.0
Other
2.21k stars 350 forks source link

IntVectorMapperTest fails in Debug Mode #202

Closed koeppl closed 10 years ago

koeppl commented 10 years ago

Hi Simon,

the test IntVectorMapperTest catches an assert abortion in Debug Mode. Stacktrace is:

#0  0x00007ffff7241967 in raise () from /usr/lib/libc.so.6
#1  0x00007ffff7242d3a in abort () from /usr/lib/libc.so.6
#2  0x00007ffff723a8ad in __assert_fail_base () from /usr/lib/libc.so.6
#3  0x00007ffff723a962 in __assert_fail () from /usr/lib/libc.so.6
#4  0x0000000000425175 in sdsl::int_vector<(unsigned char)64>::operator[] (this=0x7fffffffe2e8, idx=@0x7fffffffda38: 1) at /include/sdsl/int_vector.hpp:1243
#5  0x00000000004239d2 in sdsl::int_vector_mapper<(unsigned char)64>::push_back (this=0x7fffffffe2c0, x=1) at /include/sdsl/int_vec tor_mapper.hpp:221
#6  0x000000000040b8c6 in (anonymous namespace)::IntVectorMapperTest_push_back_Test::TestBody (this=0x683760) at IntVectorMapperTest.cpp:132
#7  0x0000000000456cc3 in void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Tes t::*)(), char const*) ()
#8  0x00000000004495a0 in testing::Test::Run() ()
#9  0x00000000004497f8 in testing::TestInfo::Run() [clone .part.367] ()
#10 0x0000000000449b15 in testing::TestCase::Run() [clone .part.368] ()
#11 0x000000000044c7ae in testing::internal::UnitTestImpl::RunAllTests() [clone .part.383] ()
#12 0x000000000044c9c3 in testing::UnitTest::Run() ()
#13 0x0000000000410121 in RUN_ALL_TESTS () at ../build/external/gtest-1.6.0/include/gtest/gtest.h:2316
#14 0x000000000040767b in main (argc=1, argv=0x7fffffffe868) at IntVectorMapperTest.cpp:287

In int_vector_mapper.hpp, the member m_wrapper has size '1', but this->size() also returns 1. Thus the line 221 m_wrapper[size()] = x; will cause an abortion. With -NDEBUG the test terminates sucessfully. I have tested with clang++ 3.5.0, g++ 4.9.1 and g++ 4.8.3.

simongog commented 10 years ago

Hi Dominik, thanks for letting us know. I think, Matthias is able to fix this. Best, Simon