-
Notifications
You must be signed in to change notification settings - Fork 277
CONTRACTS: loop assigns clause inference function #7629
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
CONTRACTS: loop assigns clause inference function #7629
Conversation
Codecov ReportPatch and project coverage have no change.
Additional details and impacted files@@ Coverage Diff @@
## develop #7629 +/- ##
========================================
Coverage 78.51% 78.51%
========================================
Files 1674 1674
Lines 191935 191935
========================================
Hits 150704 150704
Misses 41231 41231 Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report in Codecov by Sentry. |
2bd210a
to
fc1cd2a
Compare
src/goto-instrument/contracts/dynamic-frames/dfcc_infer_loop_assigns.h
Outdated
Show resolved
Hide resolved
src/goto-instrument/contracts/dynamic-frames/dfcc_infer_loop_assigns.h
Outdated
Show resolved
Hide resolved
src/goto-instrument/contracts/dynamic-frames/dfcc_infer_loop_assigns.cpp
Outdated
Show resolved
Hide resolved
src/goto-instrument/contracts/dynamic-frames/dfcc_infer_loop_assigns.cpp
Outdated
Show resolved
Hide resolved
src/goto-instrument/contracts/dynamic-frames/dfcc_infer_loop_assigns.cpp
Outdated
Show resolved
Hide resolved
src/goto-instrument/contracts/dynamic-frames/dfcc_infer_loop_assigns.cpp
Outdated
Show resolved
Hide resolved
src/goto-instrument/contracts/dynamic-frames/dfcc_infer_loop_assigns.cpp
Outdated
Show resolved
Hide resolved
src/goto-instrument/contracts/dynamic-frames/dfcc_infer_loop_assigns.cpp
Outdated
Show resolved
Hide resolved
src/goto-instrument/contracts/dynamic-frames/dfcc_infer_loop_assigns.cpp
Outdated
Show resolved
Hide resolved
src/goto-instrument/contracts/dynamic-frames/dfcc_infer_loop_assigns.cpp
Outdated
Show resolved
Hide resolved
025ff40
to
6303032
Compare
@tautschnig @qinheping I just pushed a revised version that uses root objects to widen targets, should be stable now |
6303032
to
c231116
Compare
c231116
to
32ad1ea
Compare
src/goto-instrument/contracts/dynamic-frames/dfcc_root_object.h
Outdated
Show resolved
Hide resolved
src/goto-instrument/contracts/dynamic-frames/dfcc_root_object.h
Outdated
Show resolved
Hide resolved
src/goto-instrument/contracts/dynamic-frames/dfcc_infer_loop_assigns.cpp
Show resolved
Hide resolved
src/goto-instrument/contracts/dynamic-frames/dfcc_root_object.cpp
Outdated
Show resolved
Hide resolved
src/goto-instrument/contracts/dynamic-frames/dfcc_root_object.cpp
Outdated
Show resolved
Hide resolved
src/goto-instrument/contracts/dynamic-frames/dfcc_root_object.cpp
Outdated
Show resolved
Hide resolved
src/goto-instrument/contracts/dynamic-frames/dfcc_root_object.cpp
Outdated
Show resolved
Hide resolved
9f87703
to
62e0f74
Compare
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.
LGTM
62e0f74
to
aeaad9a
Compare
5def6b7
to
8285444
Compare
@tautschnig if you have the time, could you do another round of review on this PR? |
8285444
to
c802c2d
Compare
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.
Just minor cleanup, will be good to go once the depended-on PR is merged.
src/goto-instrument/contracts/dynamic-frames/dfcc_infer_loop_assigns.h
Outdated
Show resolved
Hide resolved
src/goto-instrument/contracts/dynamic-frames/dfcc_infer_loop_assigns.h
Outdated
Show resolved
Hide resolved
src/goto-instrument/contracts/dynamic-frames/dfcc_infer_loop_assigns.cpp
Outdated
Show resolved
Hide resolved
// Target address is not constant, widening to the whole object | ||
result.emplace(make_object_whole_call_expr(address_of_expr, ns)); |
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.
What happens behind the scenes with a pointer passed to object-whole? Would it be the same as the root_object
case above?
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.
The meaning of object_whole(&expr)
or object_whole(&root_object(expr))
is the same so we don't bother computing the root object. In the first case we compute the root_object to try and get rid of a dependency on loop locals or drop the target if the root object is still local to the loop. In the second case we have a non-constant expression that does not depend on loop locals, and we just widen it directly.
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.
we have to use object_whole
because this is the predicate that DFCC understands to specify byte ranges.
src/goto-instrument/contracts/dynamic-frames/dfcc_infer_loop_assigns.cpp
Outdated
Show resolved
Hide resolved
src/goto-instrument/contracts/dynamic-frames/dfcc_infer_loop_assigns.cpp
Outdated
Show resolved
Hide resolved
Alternative implementation of `root_object` supporting ternary operators in assignment or call LHS expressions, and object slice expressions in assigns clause targets.
c802c2d
to
1b899b1
Compare
@tautschnig all suggestions implemented, could you please take a last look ? |
The first commit is from #7636, do not review.
Co-authored with @qinheping
Loop assigns clause inference function. Uses
loop_utils.h
to get a set of lvalue expressions modulo aliasing that may be assigned by the loop.The lvalue expressions are then post processed.
__CPROVER_object_whole(&root_object)
is kept as inferred target.__CPROVER_object_whole(&target)
is used as widened target.Extracted from #7541, can only be tested once all features are in place.