[llvm-bugs] [Bug 41769] New: Thread Sanitizer causes false positive on a static array
via llvm-bugs
llvm-bugs at lists.llvm.org
Mon May 6 07:38:00 PDT 2019
https://bugs.llvm.org/show_bug.cgi?id=41769
Bug ID: 41769
Summary: Thread Sanitizer causes false positive on a static
array
Product: compiler-rt
Version: unspecified
Hardware: Macintosh
OS: MacOS X
Status: NEW
Severity: normal
Priority: P
Component: compiler-rt
Assignee: unassignedbugs at nondot.org
Reporter: vincent.lebourlot at starqube.com
CC: llvm-bugs at lists.llvm.org
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.
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20190506/68612417/attachment.html>
More information about the llvm-bugs
mailing list