Ramki-Ravindran / thread-sanitizer

Automatically exported from code.google.com/p/thread-sanitizer
0 stars 0 forks source link

Possible TSan false positive with libc++.async and boost.async #73

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
======================================
1. Get a copy of http://ideone.com/43TyZE 
2. Build with TSan then run
# Build with libc++
$ clang++ -g -std=c++11 -stdlib=libc++ -fsanitize=thread async_tsan.cpp 
-lpthread && ./a.out
# Build with libstdc++ & Boost
$ clang++ -g -std=c++11 -stdlib=libstdc++ -DUSE_BOOST -fsanitize=thread 
async_tsan.cpp -lboost_thread -lboost_system && ./a.out

What is the expected output? What do you see instead?
======================================

I expect no warning from TSan. However, TSan produced 1 warning for libc++ case 
(http://pastebin.com/DcaJZKJf) and 2 warnings for libstdc++ & Boost case 
(http://pastebin.com/PpNmz0Bt).

What version of the product are you using? On what operating system?
======================================

$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 14.04.1 LTS
Release:    14.04
Codename:   trusty

$ clang++ --version
Ubuntu clang version 3.5.0-svn213717-1~exp1 (trunk) (based on LLVM 3.5.0)
Target: x86_64-pc-linux-gnu
Thread model: posix

libstdc++-4.9 and libboost1.55

Please provide any additional information below.
======================================
TSan reports no error if libstdc++.async was used.

$ clang++ -g -std=c++11 -stdlib=libstdc++ -fsanitize=thread async_tsan.cpp 
-lboost_thread -lboost_system && ./a.out

Note that boost packages from official Ubuntu repo didn't seem to work with 
libc++, therefore I didn't test the configuration.

Original issue reported on code.google.com by ken.fsfo...@gmail.com on 15 Aug 2014 at 11:16

GoogleCodeExporter commented 9 years ago
Hi,

I afraid you need to build libc++ and libboost with ThreadSanitizer enabled as 
well. See https://code.google.com/p/thread-sanitizer/issues/detail?id=69 for a 
related case and instructions.

Original comment by dvyu...@google.com on 15 Aug 2014 at 11:48