Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $ make
- clang++ main.cpp -pthread -fsanitize=thread -O0 -g -ggdb3 -fPIE -pie -fPIC -std=c++11 -stdlib=libc++
- $ ./a.out
- ==================
- WARNING: ThreadSanitizer: data race (pid=12355)
- Write of size 1 at 0x7d040000f7f0 by thread T2:
- #0 operator delete(void*) ??:0 (exe+0x00000004242b)
- #1 ReferenceCounted::release() /home/A.Romanek/tmp/tsan/main.cpp:16 (exe+0x0000000a097d)
- #2 Thread2(void*) /home/A.Romanek/tmp/tsan/main.cpp:30 (exe+0x0000000a04d3)
- Previous atomic write of size 4 at 0x7d040000f7f0 by thread T1:
- #0 __tsan_atomic32_fetch_sub ??:0 (exe+0x0000000850fa)
- #1 std::__1::__atomic_base<int, true>::fetch_sub(int, std::__1::memory_order) /usr/include/c++/v1/atomic:668 (exe+0x0000000a0831)
- #2 Thread1(void*) /home/A.Romanek/tmp/tsan/main.cpp:25 (exe+0x0000000a0473)
- Location is heap block of size 4 at 0x7d040000f7f0 allocated by main thread:
- #0 operator new(unsigned long) ??:0 (exe+0x000000041db9)
- #1 main /home/A.Romanek/tmp/tsan/main.cpp:35 (exe+0x0000000a050f)
- Thread T2 (tid=12358, running) created by main thread at:
- #0 pthread_create ??:0 (exe+0x000000045a6b)
- #1 main /home/A.Romanek/tmp/tsan/main.cpp:41 (exe+0x0000000a05ee)
- Thread T1 (tid=12357, finished) created by main thread at:
- #0 pthread_create ??:0 (exe+0x000000045a6b)
- #1 main /home/A.Romanek/tmp/tsan/main.cpp:40 (exe+0x0000000a05b2)
- SUMMARY: ThreadSanitizer: data race ??:0 operator delete(void*)
- ==================
- ThreadSanitizer: reported 1 warnings
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement