Thread sanitizer blocking the program

brahim brahim brahimalekhine@gmail.com
Fri May 29 08:58:00 GMT 2015


Hello,

I have just downloaded and built gcc 5.1:
$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/home/brahim/opt/libexec/gcc/x86_64-unknown-linux-gnu/5.1.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../configure --prefix=/home/brahim/opt/
--with-gmp=/home/brahim/opt/ --with-mpfr=/home/brahim/opt/
--with-mpc=/home/brahim/opt/ --with-cloog=/home/brahim/opt/
--with-isl=/home/brahim/opt/ --enable-plugin --enable-gold
--enable-multiarch --enable-multilib --enable-languages=c,c++,lto
--enable-lto --enable-libsanitizer --with-arch-64=native
Thread model: posix
gcc version 5.1.0 (GCC)


I am trying the thread sanitizer on a simple program compiled like this:
g++ -std=gnu++14 -Wall -Wextra -Og -ggdb3 -fno-omit-frame-pointer
test.cc -o a.out -D_GLIBCXX_DEBUG -fsanitize=thread -pthread

But the executable is always blocked. Whenever i run it with gdb and i
interrrupt (ctrl-c) the executable the stack is always like this:

(gdb) r
Starting program: /home/brahim/these/git/circular-buffer/a.out
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".

Program received signal SIGINT, Interrupt.
0x0000003b85e6f30a in malloc_consolidate () from /lib64/libc.so.6
(gdb) where
#0  0x0000003b85e6f30a in malloc_consolidate () from /lib64/libc.so.6
#1  0x0000003b85e701c1 in mallopt () from /lib64/libc.so.6
#2  0x00002aaaaaaf3cab in __tsan::InitializeInterceptors () at
../../../../libsanitizer/tsan/tsan_interceptors.cc:2389
#3  0x00002aaaaab156a3 in __tsan::Initialize
(thr=thr@entry=0x2aaaac104c00) at
../../../../libsanitizer/tsan/tsan_rtl.cc:313
#4  0x00002aaaaaad4878 in ScopedInterceptor::ScopedInterceptor
(this=0x7fffffffe200, thr=0x2aaaac104c00, fname=<optimized out>,
pc=255665919395) at
../../../../libsanitizer/tsan/tsan_interceptors.cc:190
#5  0x00002aaaaaad5ad1 in __interceptor_memset (dst=0x7fffffffe268,
v=0, size=128) at
../../../../libsanitizer/tsan/tsan_interceptors.cc:632
#6  0x0000003b86e055a3 in __pthread_initialize_minimal_internal ()
from /lib64/libpthread.so.0
#7  0x0000003b86e04dd9 in _init () from /lib64/libpthread.so.0
#8  0x0000000000000000 in ?? ()


I tried to comment the mallopt line in the source code of libsanitizer
but I have another error.

Did I do a mistake somewhere? Could you help me to make it work?

Thanks

Brahim



More information about the Gcc-help mailing list