Boost logo

Boost Users :

Subject: [Boost-users] [boost.thread?][1.46.1] "memory clobbered before allocated block"
From: Igor Gorbunov (igormbox_at_[hidden])
Date: 2011-09-07 16:57:19


Hello,

I've ran across a strange bug. GCCs mcheck reports "memory clobbered
before allocated block". Reproducible (not every run)
with the following test program when executed from gdb:

-----
#include <boost/thread.hpp>

void proc_func(){
        std::vector<int> v1(1024);
}

int main() {

        std::vector<int> v2(1024);

        boost::thread t1(proc_func);
        t1.join();

}
-----

The same test program runs fine (or I'm not been able to trigger
this bug) when recompiled with std.thread.
I'm in doubt that there is a bug in boost.thread, so maybe build system
misconfiguration or gdb bug?

stack trace:
/home/gie/work/tests/memd1/debug/test [18157] [cores: 0]
        Thread [2] 18160 [core: 0] (Suspended : Signal : SIGABRT:Aborted)
                *__GI_raise() at raise.c:64 0x7ffff70d0405
                *__GI_abort() at abort.c:92 0x7ffff70d3680
                __libc_message() at libc_fatal.c:189 0x7ffff7106dbb
                *__GI___libc_fatal() at libc_fatal.c:200 0x7ffff7106e9e
                mabort() at mcheck.c:366 0x7ffff7117aea
                checkhdr() at mcheck.c:117 0x7ffff71172eb
                freehook() at mcheck.c:190 0x7ffff71175dc
                __nptl_deallocate_tsd() at pthread_create.c:155 0x7ffff6e88129
                start_thread() at pthread_create.c:311 0x7ffff6e88b4e
                clone() at clone.S:112 0x7ffff717336d
                0x0
        Thread [1] 18157 [core: 0] (Suspended : Container)
                pthread_join() at pthread_join.c:89 0x7ffff6e89e65
                boost::thread::join() at thread.cpp:234 0x7ffff7bd2bba
                main() at main.cpp:12 0x409212

build log:
/usr/bin/make all
/usr/bin/cmake -H/home/gie/work/tests/memd1/src -B/home/gie/work/tests/memd1/debug --check-build-system CMakeFiles/Makefile.cmake 0
/usr/bin/cmake -E cmake_progress_start /home/gie/work/tests/memd1/debug/CMakeFiles /home/gie/work/tests/memd1/debug/CMakeFiles/progress.marks
/usr/bin/make -f CMakeFiles/Makefile2 all
make[1]: Entering directory `/home/gie/work/tests/memd1/debug'
/usr/bin/make -f CMakeFiles/test.dir/build.make CMakeFiles/test.dir/depend
make[2]: Entering directory `/home/gie/work/tests/memd1/debug'
cd /home/gie/work/tests/memd1/debug && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /home/gie/work/tests/memd1/src /home/gie/work/tests/memd1/src /home/gie/work/tests/memd1/debug /home/gie/work/tests/memd1/debug /home/gie/work/tests/memd1/debug/CMakeFiles/test.dir/DependInfo.cmake --color=
make[2]: Leaving directory `/home/gie/work/tests/memd1/debug'
/usr/bin/make -f CMakeFiles/test.dir/build.make CMakeFiles/test.dir/build
make[2]: Entering directory `/home/gie/work/tests/memd1/debug'
/usr/bin/cmake -E cmake_progress_report /home/gie/work/tests/memd1/debug/CMakeFiles 1
[100%] Building CXX object CMakeFiles/test.dir/main.cpp.o
/usr/bin/c++ -g -I/home/gie/work/tests/memd1/debug -std=c++0x -Wall -Wextra -pedantic -o CMakeFiles/test.dir/main.cpp.o -c /home/gie/work/tests/memd1/src/main.cpp
Linking CXX executable test
/usr/bin/cmake -E cmake_link_script CMakeFiles/test.dir/link.txt --verbose=1
/usr/bin/c++ -g CMakeFiles/test.dir/main.cpp.o -o test -rdynamic -lmcheck -lboost_thread-mt
make[2]: Leaving directory `/home/gie/work/tests/memd1/debug'
/usr/bin/cmake -E cmake_progress_report /home/gie/work/tests/memd1/debug/CMakeFiles 1
[100%] Built target test
make[1]: Leaving directory `/home/gie/work/tests/memd1/debug'
/usr/bin/cmake -E cmake_progress_start /home/gie/work/tests/memd1/debug/CMakeFiles 0

-- 
With best regards,  Igor.



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net