<html>
<head>
<base href="https://llvm.org/bugs/" />
</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 --- - null sanitizer emits too many checks"
href="https://llvm.org/bugs/show_bug.cgi?id=27581">27581</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>null sanitizer emits too many checks
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</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>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>-New Bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>nlewycky@google.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>Testcase for things that should have checks with -fsanitize=null and things
that should not:
struct X {
void nocheck(X &);
void method();
int i;
};
int &getref();
void intasptr(int *);
void check(X *ptr) {
ptr->method();
(*ptr).method();
intasptr(&ptr->i);
ptr->i++;
}
void X::nocheck(X &ref) {
ref.method(); // has extra check
method(); // has extra check
intasptr(&ref.i);
intasptr(&i); // has extra check
ref.i++;
i++; // has extra check
intasptr(&getref());
}
The checks commented as being extra are ones which would have been caught by
-fsanitize=null when attempting to construct this situation, therefore they
would lead to duplicate error emission. Fixing these is desirable to reduce the
compile time and code size impact of the null sanitizer.
There's one other case I didn't list, "(&ref)->method();" which has an extra
check. That could go either way really, it happens to be impossible to be null
but that could be emitted by the sanitizer and left to the optimizer, or if
clang finds it easy enough to locally show that it's non-null, that works too.</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>