http://gcc.gnu.org/bugzilla/show_bug.cgi?id=61095
Bug ID: 61095 Summary: tsan is broken in gcc trunk, works in 4.9 Product: gcc Version: 4.10.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: sanitizer Assignee: unassigned at gcc dot gnu.org Reporter: kcc 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 tsan seems to be broken in the current gcc trunk (Tested r210145 on Linux ubuntu 12.04). gcc 4.9.0 works fine. There have been no recent libsanitizer merges from upstream so the problem was likely introduced somewhere in the buildfiles, etc % /usr/local/gcc-4.9.0/bin/g++ -g -fsanitize=thread -fPIE -pie -static-libtsan simple_race.cc && ./a.out ================== WARNING: ThreadSanitizer: data race (pid=31025) ... % ../gcc-inst/bin/g++ -g -fsanitize=thread -fPIE -pie -static-libtsan simple_race.cc && ./a.out FATAL: ThreadSanitizer CHECK failed: ../../../../gcc/libsanitizer/tsan/tsan_rtl.cc:587 "((IsShadowMem((uptr)(p + size * kShadowCnt / kShadowCell - 1)))) != (0)" (0x0, 0x0) #0 __tsan::PrintCurrentStackSlow() ../../../../gcc/libsanitizer/tsan/tsan_rtl_report.cc:710 (a.out+0x00000005840c) #1 __tsan::TsanCheckFailed(char const*, int, char const*, unsigned long long, unsigned long long) ../../../../gcc/libsanitizer/tsan/tsan_rtl_report.cc:39 (a.out+0x0000000584e2) #2 __sanitizer::CheckFailed(char const*, int, char const*, unsigned long long, unsigned long long) ../../../../gcc/libsanitizer/sanitizer_common/sanitizer_common.cc:74 (a.out+0x00000005ea93) #3 MemoryRangeSet ../../../../gcc/libsanitizer/tsan/tsan_rtl.cc:587 (a.out+0x00000001e1d6) #4 __tsan::user_alloc(__tsan::ThreadState*, unsigned long, unsigned long, unsigned long) ../../../../gcc/libsanitizer/tsan/tsan_mman.cc:113 (a.out+0x00000005403a) #5 calloc ../../../../gcc/libsanitizer/tsan/tsan_interceptors.cc:500 (a.out+0x00000003d4d4) #6 _dl_allocate_tls <null>:0 (ld-linux-x86-64.so.2+0x000000012074) #7 __pthread_create_2_1 <null>:0 (libpthread.so.0+0x000000008abc) #8 pthread_create ../../../../gcc/libsanitizer/tsan/tsan_interceptors.cc:891 (a.out+0x00000003b758) #9 main /home/kcc/tmp/simple_race.cc:23 (a.out+0x000000079473) #10 __libc_start_main <null>:0 (libc.so.6+0x00000002176c) #11 <null> <null>:0 (a.out+0x000000010694) % cat simple_race.cc #include <pthread.h> int Global; void *Thread1(void *x) { Global++; return NULL; } int main() { pthread_t t; pthread_create(&t, NULL, Thread1, NULL); Global++; pthread_join(t, NULL); } %