<div dir="ltr"><div>Hello,</div><div><br></div><div>My hope was to aim for limited accuracy, simply because the overall complexity of the bitshift constraint is fairly simple. However, in the use case we are looking at, a large slowdown (I've read 15x, although that may be untrue now) for Z3 seems pretty bad.</div><div><br></div><div>I have been looking at a plugin for implementing this check, and since it sounds like the constraint manager doesn't have anything already to calculate more complex constraints, I intend to keep looking at calculating them as needed for the bitshift verification. This avoids direct interaction with the Ranged Constraint Manager, and just uses the results it produces, hopefully.</div><div><br></div><div>Thank you for the insight.</div><div><br></div><div>Best,</div><div>Christoph<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, Apr 19, 2020 at 5:41 AM Balázs Benics <<a href="mailto:benicsbalazs@gmail.com">benicsbalazs@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>Hi,</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div>
the existing range based constraint manager only produces constraints for certain symbols
</div></blockquote><div>You are right, our constraint manager has its limitations.</div><div><br></div><div>Right now, it can not deal with symbol comparisons like `$1 < $2` even if both `$1` and `$2` are well-constrained symbols.</div><div>Although I recently made a patch implementing such: <a href="https://reviews.llvm.org/D77792" target="_blank">D77792</a><br></div><div><br></div><div>There is already a huge complexity behind the range based constraint manager and we should not bloat it even further.</div><div>Probably a complete redesign would help, but there is no free lunch. You can not have both accuracy and speed.</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div>
... generating range constraints for some C programs, in the hopes of finding potential UB for bitshift operatio</div></blockquote><div>For precise constraint modeling, you should use the Z3 based constraint manager instead of the default ranged based one.<br>You can enable that with the `-analyzer-config -analyzer-constraints=z3` flags.<br></div><div>Note that, it will introduce a <b>significant </b>runtime overhead.<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Christoph Steefel via cfe-dev <<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>> ezt írta (időpont: 2020. ápr. 18., Szo, 23:57):<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>Hello all,</div><div><br></div><div>I have been looking into generating range constraints for some C programs, in the hopes of finding potential UB for bitshift operations. However, it seems that the existing range based constraint manager only produces constraints for certain symbols. For other symbols, such as those generated by arithmetic on a range bounded symbol, I found myself needing to calculate the new range constraint myself. Is this a reasonable path forwards, or is there some existing code that does something similar to this already?</div><div><br></div><div>I have been looking at the RangedConstraintManager, and using it's RangeSet implementation, but I also haven't found where the RangeSet is actually used.</div><div><br></div><div>Any help would be appreciated.</div><div><br></div><div>Best,</div><div>Christoph<br></div></div>
_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a><br>
<a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a><br>
</blockquote></div>
</blockquote></div>