This repository has been archived by the owner on May 4, 2024. It is now read-only.
[move-prover] treat store as copy in borrow analysis #308
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Prover panic-ed when trying to verify this simple program:
A further analysis found that the borrow summary for function
one_of_two
is notproperly constructed, with the return result not borrowing from neither
r1
orr2
(which it should be a direct borrow of
r1
orr2
).After some digging in the bytecode, it seems that we are using
r := r1
andr = r2
for the assignment, which is considered as a
Store
assignment and is treatedthe same way as a
Move
assignment. This seems correct in terms borrow semanticsbut there is no way of summarizing that
r
can be borrowed from eitherr1
orr2
which is needed in the verification of
test1
.A quick solution to this is to model
Store
as aCopy
assignment, which addsthe
BorrowEdge::Direct
in the borrow graph. The downside, however, is that theRHS of the assignment now lives longer until it is
destroy()
-ed, as can be seen inthe changes of the baseline file.
Motivation
To verify the above simple program.
Have you read the Contributing Guidelines on pull requests?
Yes
Test Plan