<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">I see your point. The checker would not issue any warnings, it can just modify the constraints on the symbolic value that is the result of the expression.</div><div class=""><br class=""></div><br class=""><div><blockquote type="cite" class=""><div class="">On 28 Feb 2016, at 21:49, יהודה שפירא <<a href="mailto:yehudahs@gmail.com" class="">yehudahs@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class=""><div class=""><div class="">Hi,<br class=""></div></div><div class="">I understand the masking but I didn't understand what scenarios this checker should catch ?</div><div class="">Should the checker just update the variable masking state and let other checkers use this masking states ?</div><div class="">Cause as I understand from the example in <a href="https://llvm.org/bugs/show_bug.cgi?id=16615" class="">bug 16615</a> we should use the masking state in the "<span style="white-space: pre-wrap;" class="">uninitialized value checker" to conclude that it always switch into one of the cases in the example.</span></div><div class=""><span style="white-space: pre-wrap;" class="">So, does the </span><span style="font-size:12.8px" class="">BitwiseMaskingChecker</span><span style="font-size:12.8px" class=""> should warn ? Or just update the state with the relevant mask and let other check use this states ?</span></div><br class=""><div class="">Regards,</div><div class="">Yehuda.</div></div><div class="gmail_extra"><br class=""><div class="gmail_quote">On Mon, Feb 22, 2016 at 2:17 AM, Ryan Govostes <span dir="ltr" class=""><<a href="mailto:rzg@apple.com" target="_blank" class="">rzg@apple.com</a>></span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word" class="">The BitwiseMaskingChecker described in the document is for a subset of possible bitwise expressions, namely, bitwise AND with a mask of the form 2^n - 1. This is because we can easily reason about the bounds of the result of the operation using the existing range-based constraint manager. That is, if I have x & 0xFFF, you know the result can be any number between 0 and 0xFFF.<div class=""><br class=""></div><div class="">However if the mask is not of the form 2^n - 1, the results do not make a contiguous range, and hence the existing constraint manager can’t reason about it. For instance, for x & 9, the possible values are { 0, 1, 8, 9 }, which is not a contiguous range.</div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">A more powerful BitwiseConstraintManager would be able to reason about a wider variety of bitwise expressions, probably by tracking constraints on each bit. For instance, it could determine that (x & 0xFFE) & 0x1 will always be zero; this cannot be efficiently proved by using a range-based constraint manager.</div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">I did implement a SMT-solver-based constraint manager that could handle arbitrary bitwise expressions, but it has not been accepted into mainline Clang. It is also very slow, and there would be huge performance benefits for using specialized constraint managers and leaving the SMT solver as a last-ditch effort.</div><div class=""><br class=""></div><div class="">Ryan</div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><div class=""><div class=""><br class=""><div class=""><blockquote type="cite" class=""><div class=""><div class="h5"><div class="">On 20 Feb 2016, at 17:26, יהודה שפירא via cfe-dev <<a href="mailto:cfe-dev@lists.llvm.org" target="_blank" class="">cfe-dev@lists.llvm.org</a>> wrote:</div><br class=""></div></div><div class=""><div class=""><div class="h5"><div dir="ltr" class=""><div class="">I have been working on the llvm project - more on the backend and I want to get more familiarized with the clang and especially with the static analyzer project.</div><div class="">So I want to try and tackle one of the open projects that listed in the site <a href="http://clang-analyzer.llvm.org/open_projects.html" target="_blank" class="">http://clang-analyzer.llvm.org/open_projects.html</a>.</div><div class="">I want to start with something simple, and so I was thinking about working on the <span style="font-family:'Lucida Grande','Lucida Sans Unicode',Arial,Verdana,Helvetica,sans-serif;line-height:13px" class="">BitwiseMaskingChecker </span><span style="font-family:'Lucida Grande','Lucida Sans Unicode',Arial,Verdana,Helvetica,sans-serif;line-height:13px" class=""> (</span><a href="http://llvm.org/bugs/show_bug.cgi?id=16615" style="font-family:'Lucida Grande','Lucida Sans Unicode',Arial,Verdana,Helvetica,sans-serif;line-height:13px" target="_blank" class="">PR16615</a>) unless you think it not a good start.</div><div class="">I understand that bitwise reasoning is missing, but should it be in a checker ? Isn't that suppose to be in the "<span style="font-family:'Lucida Grande','Lucida Sans Unicode',Arial,Verdana,Helvetica,sans-serif;line-height:13px" class="">BitwiseConstraintManager</span><span style="font-family:'Lucida Grande','Lucida Sans Unicode',Arial,Verdana,Helvetica,sans-serif;line-height:13px" class="">" (another open project in the site above).</span></div><div class=""><font face="Lucida Grande, Lucida Sans Unicode, Arial, Verdana, Helvetica, sans-serif" class=""><span style="line-height:13px" class="">What am I missing ? W</span></font>hat is the purpose of the <span style="font-family:'Lucida Grande','Lucida Sans Unicode',Arial,Verdana,Helvetica,sans-serif;line-height:13px" class="">BitwiseMaskingChecker </span>? to check what exactly ?</div><div class=""><br class=""></div><div class="">Regards,</div><div class="">Yehuda.</div></div></div></div>
_______________________________________________<br class="">cfe-dev mailing list<br class=""><a href="mailto:cfe-dev@lists.llvm.org" target="_blank" class="">cfe-dev@lists.llvm.org</a><br class=""><a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" target="_blank" class="">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a><br class=""></div></blockquote></div><br class=""></div></div></div></div></blockquote></div><br class=""></div>
</div></blockquote></div><br class=""></body></html>