Hi, I have tried to compile my source code with the thread sanitizer and got an error which I did not really understand. I was able to narrow the problem down to a short example (see attached file). To me this seems like some sort of false positive. Can you please take a look at it? And if it is false positive, can it be avoided somehow? Blacklisted?
Thank you for your time, the thread sanitizer is a great tool (I have already fixed some real bugs thanks to it! And maybe this is my bug as well, but I just do not know C++ enough?).
Pavel Cernohorsky
---
$ clang++ --version
clang version 3.8.1-24 (tags/RELEASE_381/final)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
- but we reported by newer releases as well
$ clang++ --std=c++1z -ggdb3 -fsanitize=thread thread_sanitizer_problem.cpp
$ while ./a.out ; do :; done
... data race in between the future's get and promise's delete? why?
--
You received this message because you are subscribed to the Google Groups "thread-sanitizer" group.
To unsubscribe from this group and stop receiving emails from it, send an email to thread-sanitiz...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
<thread_sanitizer_problem.cpp>
# mostly based on https://clang.llvm.org/get_started.html, https://github.com/google/sanitizers/wiki/MemorySanitizerLibcxxHowTo and https://groups.google.com/forum/#!topic/thread-sanitizer/yyC7L1FYW5c
docker run --rm -it debian:buster bash
apt-get update
apt-get install cmake g++ python subversion
cd ~
svn co http://llvm.org/svn/llvm-project/llvm/tags/RELEASE_500/final llvm
cd llvm/tools
svn co http://llvm.org/svn/llvm-project/cfe/tags/RELEASE_500/final clang
cd clang/tools
svn co http://llvm.org/svn/llvm-project/clang-tools-extra/tags/RELEASE_500/final extra
cd ../../../projects/
svn co http://llvm.org/svn/llvm-project/compiler-rt/tags/RELEASE_500/final compiler-rt
svn co http://llvm.org/svn/llvm-project/libcxx/tags/RELEASE_500/final libcxx
svn co http://llvm.org/svn/llvm-project/libcxxabi/tags/RELEASE_500/final libcxxabi
cd ../..
mkdir build.normal
cd build.normal
cmake ../llvm -DCMAKE_BUILD_TYPE=Release
make -j8
make install
cd ..
ldconfig
mkdir build.tsan
cd build.tsan
cmake ../llvm -DCMAKE_BUILD_TYPE=Release -DLLVM_USE_SANITIZER=Thread -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++
make -j8
cd ..
# get the application into the docker
# build the application
clang++ thread_sanitizer_problem.cpp --std=c++1z -ggdb3 -stdlib=libc++ -fsanitize=thread
# run the application
LD_LIBRARY_PATH=build.tsan/lib ./a.out