Advertisement
Guest User

ThreadSanitizer result for std::atomic (libc++)

a guest
Jul 1st, 2014
240
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.49 KB | None | 0 0
  1. $ make
  2. clang++ main.cpp -pthread -fsanitize=thread -O0 -g -ggdb3 -fPIE -pie -fPIC -std=c++11 -stdlib=libc++
  3.  
  4. $ ./a.out
  5. ==================
  6. WARNING: ThreadSanitizer: data race (pid=12355)
  7. Write of size 1 at 0x7d040000f7f0 by thread T2:
  8. #0 operator delete(void*) ??:0 (exe+0x00000004242b)
  9. #1 ReferenceCounted::release() /home/A.Romanek/tmp/tsan/main.cpp:16 (exe+0x0000000a097d)
  10. #2 Thread2(void*) /home/A.Romanek/tmp/tsan/main.cpp:30 (exe+0x0000000a04d3)
  11.  
  12. Previous atomic write of size 4 at 0x7d040000f7f0 by thread T1:
  13. #0 __tsan_atomic32_fetch_sub ??:0 (exe+0x0000000850fa)
  14. #1 std::__1::__atomic_base<int, true>::fetch_sub(int, std::__1::memory_order) /usr/include/c++/v1/atomic:668 (exe+0x0000000a0831)
  15. #2 Thread1(void*) /home/A.Romanek/tmp/tsan/main.cpp:25 (exe+0x0000000a0473)
  16.  
  17. Location is heap block of size 4 at 0x7d040000f7f0 allocated by main thread:
  18. #0 operator new(unsigned long) ??:0 (exe+0x000000041db9)
  19. #1 main /home/A.Romanek/tmp/tsan/main.cpp:35 (exe+0x0000000a050f)
  20.  
  21. Thread T2 (tid=12358, running) created by main thread at:
  22. #0 pthread_create ??:0 (exe+0x000000045a6b)
  23. #1 main /home/A.Romanek/tmp/tsan/main.cpp:41 (exe+0x0000000a05ee)
  24.  
  25. Thread T1 (tid=12357, finished) created by main thread at:
  26. #0 pthread_create ??:0 (exe+0x000000045a6b)
  27. #1 main /home/A.Romanek/tmp/tsan/main.cpp:40 (exe+0x0000000a05b2)
  28.  
  29. SUMMARY: ThreadSanitizer: data race ??:0 operator delete(void*)
  30. ==================
  31. ThreadSanitizer: reported 1 warnings
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement