<div dir="ltr">A few high level comments.<div><br></div><div>"-fblocks -Wunreachable-code" is there any reason your test cases have these flags?</div><div>"if (!x == 10) {}" there is an existing warning for this called -Wlogical-not-parentheses.  The check should be folded into there.</div>
<div>"if ((x < y) == 10) {}" ditto this and -Wtautological-compare-out-of-range</div><div>"logical disjunction always evaluates to true"  I wouldn't expect all programmers to understand what a logical disjunction is.</div>
<div><br></div><div>If you check out -Wlogical-not-parentheses and -Wtautological-compare-out-of-range, they are in lib/Sema/SemaChecking.cpp.  Why did you use a CFG approach instead?</div></div><div class="gmail_extra"><br>
<br><div class="gmail_quote">On Fri, Oct 25, 2013 at 10:18 AM, Jordan Rose <span dir="ltr"><<a href="mailto:jordan_rose@apple.com" target="_blank">jordan_rose@apple.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Richard Trieu has worked on a number of similar warnings. Maybe he can take a look?<br>
<br>
Jordan<br>
<div><div class="h5"><br>
<br>
On Oct 25, 2013, at 8:18, Anders Rönnholm <<a href="mailto:Anders.Ronnholm@evidente.se">Anders.Ronnholm@evidente.se</a>> wrote:<br>
<br>
> Hi,<br>
> Resending the patch I sent last week. Anyone want to have a look at it?<br>
><br>
> //Anders<br>
><br>
> -----Original Message-----<br>
> From: Anders Rönnholm<br>
> Sent: den 18 oktober 2013 16:05<br>
> To: <a href="mailto:cfe-commits@cs.uiuc.edu">cfe-commits@cs.uiuc.edu</a><br>
> Subject: [PATCH] check for Incorrect logic in operator<br>
><br>
> Hi,<br>
><br>
> I have a new patch I like to get reviewed. It checks for incorrect logics in relational,equal and logic operators in cfgbuilder when trying to evaluate bool. A warning is emitted in Sema when an error occurs.<br>
><br>
> eg.<br>
> if (x != 2 || x != 3) { } always true<br>
> if ((x < y) <= 10) {}  always true<br>
><br>
> Thanks,<br>
> Anders<br>
</div></div>> <incorrectoperatorlogic.diff>_______________________________________________<br>
> cfe-commits mailing list<br>
> <a href="mailto:cfe-commits@cs.uiuc.edu">cfe-commits@cs.uiuc.edu</a><br>
> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits</a><br>
<br>
</blockquote></div><br></div>