<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Mon, Aug 25, 2014 at 2:23 PM, Richard Trieu <span dir="ltr"><<a href="mailto:rtrieu@google.com" target="_blank">rtrieu@google.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr">I brought up the same question last year.  By including this in the CFG builder, the other analysis that use the CFG can use the tautological results for better diagnostics.<div>
<br></div><div><a href="http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20131028/091857.html" target="_blank">http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20131028/091857.html</a></div></div></blockquote>
<div><br></div><div>Interesting; I'm sorry I missed that thread...</div><div><br></div><div>I agree with a lot of the arguments, but I am not persuaded by the conclusion. We should not require a CFG to be built in order to analyze non-control-flow-dependent properties of expressions; that puts the cart before the horse. And there's more problems muddled up in here -- our expression evaluator also has a 'try to evaluate this using any tricks you like' mode, which gives us a *third* way of checking for tautological comparisons.</div>
<div><br></div><div>I think we need to take a step back and design this all properly. It looks like a good approach would have been to factor out the code for computing these 'known' comparison results into some common layer that could be used by the evaluator, by SemaChecking, and when building the CFG. In fact, perhaps the best home for them would simply be within the expression evaluator; the CFG builder *already* calls it in these cases, but then it does some additional "patch up" work in these special cases. SemaChecking's -Wtautological-compare could then evaluate the comparison, and diagnose if the result is known (with appropriate smarts for picking the right diagnostic message).</div>
<div><br></div><div>Thoughts?</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div class="">
<div class="h5"><div class="gmail_extra"><div class="gmail_quote">On Mon, Aug 25, 2014 at 12:30 PM, Richard Smith <span dir="ltr"><<a href="mailto:richard@metafoo.co.uk" target="_blank">richard@metafoo.co.uk</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">
<div><div>On Mon, Aug 25, 2014 at 9:19 AM, Anders Rönnholm <span dir="ltr"><<a href="mailto:Anders.Ronnholm@evidente.se" target="_blank">Anders.Ronnholm@evidente.se</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Hi,<br>
<br>
I have made a new bitwise comparison always true check for relational comparisons i'd like to get reviewed.<br>
<br>
e.g<br>
if ((x & 64) < 65) // bitwise comparison always evaluates to true</blockquote><div><br></div></div></div><div>I'm very surprised to see this being implemented in Analysis/CFG.cpp; this belongs in Sema/SemaChecking.cpp. It makes no sense to me to couple this check to building a CFG.</div>
</div></div></div></blockquote></div></div></div></div></blockquote></div></div></div>