Open llvmbot opened 5 years ago
The following code causes a false data race detection.
#include <array> #include <thread> #include <vector> class String{ public: std::array<unsigned char,16>value; String(const char(&s)[2])noexcept:value(){std::memcpy(value.data(),s,1);} }; void createStaticAndFind(){ static const std::array<String,3>a={"1","2","3"}; if(a[2].value==String("3").value){}} int main(){ std::vector<std::thread>threads; for(size_t i=0;i<100;++i){ threads.emplace_back(createStaticAndFind);} return 0;}
Compiled and linked with -L/usr/local/lib and -fsanitize=thread.
The attached test case is a shorter example causing false positives.
Extended Description
The following code causes a false data race detection.
Compiled and linked with -L/usr/local/lib and -fsanitize=thread.