-
Notifications
You must be signed in to change notification settings - Fork 84
Bitfield Domain #1623
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bitfield Domain #1623
Conversation
…d some revision. Possible side-effects and runtime in O(n^2) while O(n) should be possible.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Semgrep OSS found more than 20 potential problems in the proposed changes. Check the Files changed tab for more details.
…act bitfield by eliminating constants that would result in a shift to zero beforehand
* implemented modulo * current changes * implementation of add, sub, mul based on paper * implemented neg * bug fixes for arith operators --------- Co-authored-by: Adrian Krauß <[email protected]>
Overflow and wrapping
More Pull request feedback
…s not assume sign bit extension with negative first param
…lyzer into pull-request-feedback
|
Thanks for addressing my comments! I think I'm now satisfied. There are some unresolved comments from @michael-schwarz and @jerhard among the hundreds of "hidden items" above. So before merging those should be still considered. Just nothing it here since they're hidden by default and thus easy to miss. |
|
The old ones were almost all addressed, I closed them. The open one is this one #1623 (comment) and the one about Great job everyone 💯 🎉 🎉 |
change refinement as requested
CHANGES: * Add division by zero analysis (goblint/analyzer#1764). * Add bitfield domain (goblint/analyzer#1623). * Add weakly-relational C-2PO pointer analysis (goblint/analyzer#1485). * Add widening delay (goblint/analyzer#1358, goblint/analyzer#1442, goblint/analyzer#1483). * Add narrowing of globals to top-down solver (goblint/analyzer#1636). * Add weak dependencies to top-down solver (goblint/analyzer#1746, goblint/analyzer#1747). * Add YAML ghost witness generation (goblint/analyzer#1394). * Remove GraphML witness generation (goblint/analyzer#1732, goblint/analyzer#1733, goblint/analyzer#1738). * Use C standard option for preprocessing (goblint/analyzer#1807). * Add bash completion for array options (goblint/analyzer#1670, goblint/analyzer#1705, goblint/analyzer#1750). * Make `malloc(0)` semantics configurable (goblint/analyzer#1418, goblint/analyzer#1777). * Update path-sensitive analyses (goblint/analyzer#1785, goblint/analyzer#1791, goblint/analyzer#1792). * Fix evaluation of library function arguments (goblint/analyzer#1758, goblint/analyzer#1761). * Optimize affine equalities analysis using sparse matrices (goblint/analyzer#1459, goblint/analyzer#1625). * Prepare for parallelism (goblint/analyzer#1708, goblint/analyzer#1744, goblint/analyzer#1748, goblint/analyzer#1781, goblint/analyzer#1790).
Overview
This pull request enhances the existing
IntDomainby introducing a new BitfieldDomain. The fullIntDomainnow consists of(DefExc, Interval, Enums, Congruence, IntervalSet, Bitfield).The new Bitfield Domain is based on the Paper
Abstract Domains for Bit-Level Machine Integer and Floating-Point Operations, and keeps track of each bit in an integer individually (conceptually, this is similar to a boolean lattice for each bit).This allows for very precise analysis of bitwise operations.
The new domain can be enabled with
--enable ana.int.bitfieldExample
For example, joining$of\_int(8) \sqcup of\_int(10) \equiv 0b1000 \sqcup 0b1010 = 0b10?0$ maintains most information about the bits; only the second bit differs in both numbers and therefore becomes unknown (unknown bits are shown using a question-mark symbol).
In this case, no over-approximation happens and the join is exact.
Bitwise operators such as
&, |, <<, >>, ~, ...can now deal with this information very precisely.Refinements
As the existing
IntDomainallows for mutual refinements of the subdomains, this PR also adds all newly possible refinement directions to improve precision in theIntDomain.We did, however, have some problems with non-termination when using refinements.
Some of these issues are however also present on the master branch, and indicate a more fundamental problem with refinements (See #1671).
Note
This implementation is part of the
Automated Bug Hunting and Beyondpractical course at TUM.