<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 --- - deleting null pointer indirection is far too aggressive" href="https://urldefense.proofpoint.com/v2/url?u=https-3A__llvm.org_bugs_show-5Fbug.cgi-3Fid-3D23831&d=AwMBaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=pF93YEPyB-J_PERP4DUZOJDzFVX5ZQ57vQk33wu0vio&m=fOaH61PjaSWI7h6reMNlcBEiMq104vtEd8MhIxZqrm8&s=srkMbjaiMhuc2WKSlzOHbG4RhQ7h-wOjDaXFnMbqah8&e=">23831</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>deleting null pointer indirection is far too aggressive
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>All
</td>
</tr>
<tr>
<th>OS</th>
<td>All
</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>danalbert@google.com
</td>
</tr>
<tr>
<th>CC</th>
<td>chh@google.com, enh@google.com, llvmbugs@cs.uiuc.edu, nlewycky@google.com, srhines@google.com, timmurray@google.com
</td>
</tr>
<tr>
<th>Blocks</th>
<td>21420
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>$ cat foo.cpp
int main() {
*(int*)0 = 0;
}
$ clang++ foo.cpp
foo.cpp:2:3: warning: indirection of non-volatile null pointer will be deleted,
not trap [-Wnull-dereference]
*(int*)0 = 0;
^~~~~~~~
foo.cpp:2:3: note: consider using __builtin_trap() or qualifying pointer with
'volatile'
1 warning generated.
This is far too aggressive. It's very obvious what the user wanted (each case
of this I've had to clean up in android had a comment like "force a crash".
Yes, the user almost always wanted abort() or __builtin_trap() rather than what
they wrote, but we can't rewrite the world's code over night, so this hinders
adoption.</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>