CONTRACTS: ignore __CPROVER_dead_object
assignments
#8554
Merged
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.
Fixes model-checking/kani#3796.
This change fixes spurious violations on GOTO models generated from MIR programs by Kani. MIR programs declare all stack-allocated place variables at the top of the function regardless of the original scope of the variable, and uses
storageLive
andstorageDead
events to delimit their dynamic lifetime. Kani uses a DECL to introduce place variables and uses dynamic assignments to__CPROVER_dead_object
to encodestorageLive
andstorageDead
. DFCC instrumentation would only pick upstorageDead
events, notstorageLive
, resulting in spurious proof failures.With this change we go back to relying only on DECL/DEAD for object liftetime tracking in DFCC and completely ignoring dynamic assignments to
__CPROVER_dead_object
. This means that contract instrumentation won't be able to detect bad accesses to objects for which the lifetime is managed via__CPROVER_dead_object
anymore, for instance: dynamic stack-allocated objects created usingalloca
, or MIR place variables (that have their address taken) as encoded by Kani. As a consequence,--pointer-checks
have to be enabled when analysing contracts-instrumented code.