<html>
<head>
<base href="https://bugs.llvm.org/">
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - Thread Sanitizer causes false positive on a static array"
href="https://bugs.llvm.org/show_bug.cgi?id=41769">41769</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Thread Sanitizer causes false positive on a static array
</td>
</tr>
<tr>
<th>Product</th>
<td>compiler-rt
</td>
</tr>
<tr>
<th>Version</th>
<td>unspecified
</td>
</tr>
<tr>
<th>Hardware</th>
<td>Macintosh
</td>
</tr>
<tr>
<th>OS</th>
<td>MacOS X
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>compiler-rt
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>vincent.lebourlot@starqube.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>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.</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>