https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78294
Bug ID: 78294 Summary: -fsanitize=thread broken Product: gcc Version: 7.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: sanitizer Assignee: unassigned at gcc dot gnu.org Reporter: trippels at gcc dot gnu.org CC: dodji at gcc dot gnu.org, dvyukov at gcc dot gnu.org, jakub at gcc dot gnu.org, kcc at gcc dot gnu.org Target Milestone: --- markus@x4 ~ % echo "int main(){}" | g++ -fsanitize=thread -x c++ - && ./a.out [1] 4123 segmentation fault ./a.out Program received signal SIGSEGV, Segmentation fault. 0x0000000000000000 in ?? () (gdb) bt #0 0x0000000000000000 in ?? () #1 0x00007ffff6f4312d in __interceptor___tls_get_addr (arg=0x7ffff6ff7f68) at ../../../../gcc/libsanitizer/tsan/tsan_interceptors.cc:2421 #2 0x00007ffff6f8b00a in __tsan::ScopedIgnoreInterceptors::ScopedIgnoreInterceptors (this=<synthetic pointer>) at ../../../../gcc/libsanitizer/tsan/tsan_rtl.h:549 #3 __tsan::Initialize (thr=thr@entry=0x7ffff6277780) at ../../../../gcc/libsanitizer/tsan/tsan_rtl.cc:331 #4 0x00007ffff6f43b90 in __tsan::ScopedInterceptor::ScopedInterceptor (this=this@entry=0x7fffffffe490, thr=0x7ffff6277780, pc=140737353072294, fname=0x7ffff6fc5eea "__cxa_atexit") at ../../../../gcc/libsanitizer/tsan/tsan_interceptors.cc:256 #5 0x00007ffff6f44e67 in __interceptor___cxa_atexit (f=f@entry=0x7ffff7efd480 <std::(anonymous namespace)::generic_error_category::~generic_error_category()>, arg=arg@entry=0x7ffff7ff2410 <std::(anonymous namespace)::generic_category_instance>, dso=0x7ffff7ff2280) at ../../../../gcc/libsanitizer/tsan/tsan_interceptors.cc:399 #6 0x00007ffff7efbea6 in __static_initialization_and_destruction_0 (__initialize_p=1, __priority=65535) at ../../../../gcc/libstdc++-v3/src/c++11/compatibility-c++0x.cc:214 #7 _GLOBAL__sub_I_compatibility_c__0x.cc(void) () at ../../../../gcc/libstdc++-v3/src/c++11/compatibility-c++0x.cc:257 #8 0x00007ffff7de73a3 in call_init (env=0x7fffffffe568, argv=0x7fffffffe558, argc=1, l=<optimized out>) at dl-init.c:72 #9 _dl_init (main_map=0x7ffff7ffe130, argc=1, argv=0x7fffffffe558, env=0x7fffffffe568) at dl-init.c:120 #10 0x00007ffff7dd6c5a in _dl_start_user () from /lib64/ld-linux-x86-64.so.2 #11 0x0000000000000001 in ?? () #12 0x00007fffffffe88a in ?? () #13 0x0000000000000000 in ?? () Using the static version libtsan.a works fine. markus@x4 ~ % uname -snrvmio Linux x4 4.9.0-rc3-00450-gffbcbfca846e-dirty #79 SMP Sat Nov 5 20:22:52 CET 2016 x86_64 AuthenticAMD GNU/Linux markus@x4 ~ % /lib64/libc-2.24.90.so GNU C Library (GNU libc) development release version 2.24.90, by Roland McGrath et al. Copyright (C) 2016 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Compiled by GNU CC version 7.0.0 20161031 (experimental). Available extensions: crypt add-on version 2.1 by Michael Glad and others GNU Libidn by Simon Josefsson Native POSIX Threads Library by Ulrich Drepper et al BIND-8.2.3-T5B libc ABIs: UNIQUE IFUNC For bug reporting instructions, please see: <http://www.gnu.org/software/libc/bugs.html>.