<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On 30 May 2014 11:06, David Blaikie <span dir="ltr"><<a href="mailto:dblaikie@gmail.com" target="_blank">dblaikie@gmail.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 Fri, May 30, 2014 at 10:28 AM, Óscar Fuentes <<a href="mailto:ofv@wanadoo.es">ofv@wanadoo.es</a>> wrote:<br>
> With optmizations on, the `return' on this code:<br>
><br>
> bool foo(int &k) {<br>
> return &k != nullptr;<br>
> }<br>
><br>
> is reduced to `return true;'.<br>
><br>
> Is there an option for disabling this optimization?<br>
<br>
</div>Nope, this was committed in<br>
<a href="http://llvm.org/viewvc/llvm-project?rev=209723&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=209723&view=rev</a> and doesn't<br>
look like it has any flag control.<br>
<br>
This code has Undefined Behavior (by binding a dereferenced null<br>
pointer to a reference).<br></blockquote><div><br></div><div>There isn't a warning for this. There should be a tautological comparison warning here.</div><div><br></div><div>Nick</div></div></div></div>