<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 - kmsan: false negative on bitfields"
href="https://bugs.llvm.org/show_bug.cgi?id=40510">40510</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>kmsan: false negative on bitfields
</td>
</tr>
<tr>
<th>Product</th>
<td>compiler-rt
</td>
</tr>
<tr>
<th>Version</th>
<td>unspecified
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>enhancement
</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>dvyukov@google.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>clang version 8.0.0 (trunk 350842)
struct A {
int a:1;
int b:1;
int c:1;
int d:1;
int e:1;
};
A* newA()
{
A* a = new A;
a->c = 0;
a->d = 1;
return a;
}
#include <stdio.h>
int main()
{
volatile A* volatile a = newA();
if (a->b)
printf("1\n");
return 0;
}
clang++ /tmp/init.cc -O2 -fsanitize=memory -g && ./a.out
Does not report the use of uninit.
Generated code initializes whole shadow to 0:
0000000000000000 <_Z4newAv>:
0: 53 push %rbx
1: 48 8b 05 00 00 00 00 mov 0x0(%rip),%rax # 8 <_Z4newAv+0x8>
8: 64 48 c7 00 00 00 00 movq $0x0,%fs:(%rax)
f: 00
10: 48 8b 1d 00 00 00 00 mov 0x0(%rip),%rbx # 17
<_Z4newAv+0x17>
17: 64 48 c7 03 00 00 00 movq $0x0,%fs:(%rbx)
1e: 00
1f: bf 04 00 00 00 mov $0x4,%edi
24: e8 00 00 00 00 callq 29 <_Z4newAv+0x29>
29: 48 b9 00 00 00 00 00 movabs $0x500000000000,%rcx
30: 50 00 00
33: 48 31 c1 xor %rax,%rcx
36: c6 01 00 movb $0x0,(%rcx)
39: c6 00 08 movb $0x8,(%rax)
3c: 64 48 c7 03 00 00 00 movq $0x0,%fs:(%rbx)
43: 00
44: 5b pop %rbx
45: c3 retq</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>