<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><br><div><div>On Nov 8, 2013, at 1:55 PM, Richard Trieu <<a href="mailto:rtrieu@google.com">rtrieu@google.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div dir="ltr">I'm fine with it for now.  We can use this to evaluate the difference between CFG and Sema based warnings.  </div></blockquote><blockquote type="cite"><div dir="ltr">Eventually, I would like to see the warnings in one place.</div><div class="gmail_extra"><br></div></blockquote><div><br></div><div>I agree.</div><br><blockquote type="cite"><div class="gmail_extra"><br>
<div class="gmail_quote">On Fri, Nov 8, 2013 at 11:13 AM, Anna Zaks <span dir="ltr"><<a href="mailto:ganna@apple.com" target="_blank">ganna@apple.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div style="word-wrap:break-word">Richard,<div><br></div><div>Are you OK with this warning going on the CFG?</div><div><br></div><div>Thanks,</div><div>Anna.</div><div><div class="h5"><br><div><div>On Nov 7, 2013, at 2:42 AM, Anders Rönnholm <<a href="mailto:Anders.Ronnholm@evidente.se" target="_blank">Anders.Ronnholm@evidente.se</a>> wrote:</div>
<br><blockquote type="cite"><div lang="SV" link="blue" vlink="purple" style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">
<div><div style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><span lang="EN-US">I don't have any strong opinions of where to place the check. I will place it where you feel is the best place for it.<u></u><u></u></span></div>
<div style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><span lang="EN-US"> </span></div><div style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><span lang="EN-US">I think I would be good if CFG could use it at least as it already has some checks to see if an expression always evaluates to true/false.<u></u><u></u></span></div>
<div style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><span lang="EN-US"> </span></div><div style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><span lang="EN-US">//Anders<u></u><u></u></span></div>
<div style="margin:0cm 0cm 0.0001pt;font-size:12pt;font-family:'Times New Roman',serif"><span lang="EN-US" style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)"> </span></div><div style="border-style:none none none solid;border-left-color:blue;border-left-width:1.5pt;padding:0cm 0cm 0cm 4pt">
<div><div style="border-style:solid none none;border-top-color:rgb(181,196,223);border-top-width:1pt;padding:3pt 0cm 0cm"><div style="margin:0cm 0cm 0.0001pt;font-size:12pt;font-family:'Times New Roman',serif"><b><span lang="EN-US" style="font-size:10pt;font-family:Tahoma,sans-serif">From:</span></b><span lang="EN-US" style="font-size:10pt;font-family:Tahoma,sans-serif"><span> </span>Anna Zaks [<a href="mailto:ganna@apple.com" target="_blank">mailto:ganna@apple.com</a>]<span> </span><br>
<b>Sent:</b><span> </span>den 30 oktober 2013 19:25<br><b>To:</b><span> </span>Jordan Rose; Ted Kremenek<br><b>Cc:</b><span> </span>Richard Trieu; Anders Rönnholm; <a href="mailto:cfe-commits@cs.uiuc.edu" target="_blank">cfe-commits@cs.uiuc.edu</a><br>
<b>Subject:</b><span> </span>Re: [PATCH] check for Incorrect logic in operator<u></u><u></u></span></div></div></div><div style="margin:0cm 0cm 0.0001pt;font-size:12pt;font-family:'Times New Roman',serif"><span lang="EN-US"> </span></div>
<div style="margin:0cm 0cm 0.0001pt;font-size:12pt;font-family:'Times New Roman',serif"><span lang="EN-US"> </span></div><div><div><div style="margin:0cm 0cm 0.0001pt;font-size:12pt;font-family:'Times New Roman',serif">
On Oct 30, 2013, at 9:28 AM, Jordan Rose <<a href="mailto:jordan_rose@apple.com" style="color:purple;text-decoration:underline" target="_blank">jordan_rose@apple.com</a>> wrote:<u></u><u></u></div></div><div style="margin:0cm 0cm 0.0001pt;font-size:12pt;font-family:'Times New Roman',serif">
<br><br><u></u><u></u></div><div><div style="margin:0cm 0cm 0.0001pt;font-size:12pt;font-family:'Times New Roman',serif"><u></u> <u></u></div><div><div><div style="margin:0cm 0cm 0.0001pt;font-size:12pt;font-family:'Times New Roman',serif">
<span lang="EN-US">On Oct 29, 2013, at 19:14 , Richard Trieu <</span><a href="mailto:rtrieu@google.com" style="color:purple;text-decoration:underline" target="_blank"><span lang="EN-US">rtrieu@google.com</span></a><span lang="EN-US">> wrote:<u></u><u></u></span></div>
</div><div style="margin:0cm 0cm 0.0001pt;font-size:12pt;font-family:'Times New Roman',serif"><span lang="EN-US"><br><br><u></u><u></u></span></div><blockquote style="border-style:none none none solid;border-left-color:rgb(204,204,204);border-left-width:1pt;padding:0cm 0cm 0cm 6pt;margin-left:4.8pt;margin-right:0cm;font-size:inherit;text-align:-webkit-auto;word-spacing:0px">
<div><div style="margin:0cm 0cm 0.0001pt;font-size:12pt;font-family:'Times New Roman',serif"><span style="font-family:Helvetica,sans-serif">With these points in mind, are there particular concerns about cases where the “CFG won’t check all the code a Sema based warning would”.  If you addressed the last point, I think you’d pretty much get the coverage that you want.  What do you think?<u></u><u></u></span></div>
</div><div><div style="margin:0cm 0cm 0.0001pt;font-size:12pt;font-family:'Times New Roman',serif"><span style="font-family:Helvetica,sans-serif"> </span></div></div></blockquote><div><div style="margin:0cm 0cm 0.0001pt;font-size:12pt;font-family:'Times New Roman',serif">
<span style="font-family:Helvetica,sans-serif">I think that globals and global initializers are not represented in the CFG.  That's my main concern about using only the CFG at the moment.<u></u><u></u></span></div></div>
<div style="margin:0cm 0cm 0.0001pt;font-size:12pt;font-family:'Times New Roman',serif"><u></u> <u></u></div></div><div><div style="margin:0cm 0cm 0.0001pt;font-size:12pt;font-family:'Times New Roman',serif">
I don't think it would be difficult to build a CFG from a single global initializer (or member initializer). No one's done it yet, but I don't think that means it can't be done.<u></u><u></u></div></div><div>
<div style="margin:0cm 0cm 0.0001pt;font-size:12pt;font-family:'Times New Roman',serif"><u></u> <u></u></div></div><div><div style="margin:0cm 0cm 0.0001pt;font-size:12pt;font-family:'Times New Roman',serif">
On the more general issue I can see both sides: avoiding extra walks over the AST or CFG is good, knowing what's trivially dead code is good (except when it isn't), and not conflating concerns is good.<u></u><u></u></div>
</div><div><div style="margin:0cm 0cm 0.0001pt;font-size:12pt;font-family:'Times New Roman',serif"><u></u> <u></u></div></div><div><div style="margin:0cm 0cm 0.0001pt;font-size:12pt;font-family:'Times New Roman',serif">
For these particular checks, though (and I haven't looked at the patch, just the checks), I think they are fundamentally syntactic checks, not flow-sensitive ones, and that we will actually get little benefit out of using this information to improve the CFG.<u></u><u></u></div>
</div></div><div><div style="margin:0cm 0cm 0.0001pt;font-size:12pt;font-family:'Times New Roman',serif"><u></u> <u></u></div></div><div style="margin:0cm 0cm 0.0001pt;font-size:12pt;font-family:'Times New Roman',serif">
We are still constructing a CFG after reporting these warnings, so it would be beneficial to feed the output of these checks into CFG construction. This way the CFG and CFG based warnings(and static analyzer checks) will be consistent with these warnings. Also, we could possibly extend the warning to show a note on code which becomes unreachable along with the diagnostic and extend it to cover more intricate flow sensitive cases in the future. <u></u><u></u></div>
</div><div><div style="margin:0cm 0cm 0.0001pt;font-size:12pt;font-family:'Times New Roman',serif"><u></u> <u></u></div></div><div><div style="margin:0cm 0cm 0.0001pt;font-size:12pt;font-family:'Times New Roman',serif">
If we can add the analysis of globals, there is no downside of performing the checks when we build the CFG as far as I can tell. Not sure if there are performance implications - do we always build the CFG?<u></u><u></u></div>
</div><div><div style="margin:0cm 0cm 0.0001pt;font-size:12pt;font-family:'Times New Roman',serif"><br><br><u></u><u></u></div><div><div><div style="margin:0cm 0cm 0.0001pt;font-size:12pt;font-family:'Times New Roman',serif">
Each case is warning about a likely-incorrect boolean expression, which implies that if the user fixed the expression we could easily get a different CFG. That doesn't help answer questions of general policy, but it might at least untangle this patch from the discussion.<u></u><u></u></div>
</div><div><div style="margin:0cm 0cm 0.0001pt;font-size:12pt;font-family:'Times New Roman',serif"><u></u> <u></u></div></div><div><div style="margin:0cm 0cm 0.0001pt;font-size:12pt;font-family:'Times New Roman',serif">
Jordan<u></u><u></u></div></div></div><div style="margin:0cm 0cm 0.0001pt;font-size:12pt;font-family:'Times New Roman',serif"><span lang="EN-US">_______________________________________________<br>cfe-commits mailing list<br>
</span><a href="mailto:cfe-commits@cs.uiuc.edu" style="color:purple;text-decoration:underline" target="_blank"><span lang="EN-US">cfe-commits@cs.uiuc.edu</span></a><span lang="EN-US"><br></span><a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits" style="color:purple;text-decoration:underline" target="_blank"><span lang="EN-US">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits</span></a></div>
</div></div></div></div></blockquote></div><br></div></div></div></blockquote></div><br></div>
</blockquote></div><br></body></html>