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.
What is this needed for
This is needed to implement contracts for function pointers. A pure contract is used as a default value for a function pointer passed from the environment for which we assume a contract holds.
Pure contracts
We introduce a new built-in
void __CPROVER_pure_contract()
which can be used to mark a function as a pure contract:__CPROVER_pure_contract
must be the only statement in the body of the function__CPROVER_pure_contract
(i.e. in functions that contain other instructions) will trigger conversion errorsassert(false, "all calls replaced")
with property classID_pure_contract
.This essentially forces the user to replace calls to pure contracts by their actual contract. To make this easy on the user, a new goto-instrument CLI switch
--replace-pure-contracts
has been added, which replaces all calls to pure contracts globally.Once replacement is done, the
ID_pure_contract
assertions cannot be falsified anymore.Next steps
In a subsequent PR we will completely automate the generation of the body of the pure contract from the contract clauses and remove the
--replace-pure-contracts
CLI switch andassert(false, "all calls replaced")
assertion.