<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="">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><blockquote type="cite" class=""><div class="">On 20 Feb 2016, at 17:26, יהודה שפירא via cfe-dev <<a href="mailto:cfe-dev@lists.llvm.org" class="">cfe-dev@lists.llvm.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><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" 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" 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>
_______________________________________________<br class="">cfe-dev mailing list<br class=""><a href="mailto:cfe-dev@lists.llvm.org" class="">cfe-dev@lists.llvm.org</a><br class="">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev<br class=""></div></blockquote></div><br class=""></div></div></div></body></html>