<div dir="ltr"><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Jun 12, 2014 at 11:40 AM, Stephan Bergmann <span dir="ltr"><<a href="mailto:sbergman@redhat.com" target="_blank">sbergman@redhat.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="">On 06/06/2014 11:39 PM, Richard Trieu wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Author: rtrieu<br>
Date: Fri Jun 6 16:39:26 2014<br>
New Revision: 210372<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=210372&view=rev" target="_blank">http://llvm.org/viewvc/llvm-<u></u>project?rev=210372&view=rev</a><br>
Log:<br>
Add -Wtautological-undefined-<u></u>compare and -Wundefined-bool-conversion warnings<br>
to detect underfined behavior involving pointers.<br>
</blockquote>
<br></div>
Given that code that offends -Wtautological-undefined-<u></u>compare (by checking a reference for null) often also deliberately creates such null references, a la<br>
<br>
int & r = *(int*)0;<br>
<br>
is there any fundamental reason to not also add a warning for such constructs?</blockquote></div><br>Makes sense to me. We should warn for anything which the full power of the Clang-side constant folding can see a null pointer being bound to a reference, provided it isn't in dead code (which we already have a mechanism for).</div>
</div>