Thread sanitizer blocking the program

brahim brahim
Fri May 29 08:58:00 GMT 2015


I have just downloaded and built gcc 5.1:
$ gcc -v
Using built-in specs.
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 -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/".

Program received signal SIGINT, Interrupt.
0x0000003b85e6f30a in malloc_consolidate () from /lib64/
(gdb) where
#0  0x0000003b85e6f30a in malloc_consolidate () from /lib64/
#1  0x0000003b85e701c1 in mallopt () from /lib64/
#2  0x00002aaaaaaf3cab in __tsan::InitializeInterceptors () at
#3  0x00002aaaaab156a3 in __tsan::Initialize
(thr=thr@entry=0x2aaaac104c00) at
#4  0x00002aaaaaad4878 in ScopedInterceptor::ScopedInterceptor
(this=0x7fffffffe200, thr=0x2aaaac104c00, fname=<optimized out>,
pc=255665919395) at
#5  0x00002aaaaaad5ad1 in __interceptor_memset (dst=0x7fffffffe268,
v=0, size=128) at
#6  0x0000003b86e055a3 in __pthread_initialize_minimal_internal ()
from /lib64/
#7  0x0000003b86e04dd9 in _init () from /lib64/
#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?



More information about the Gcc-help mailing list