-
Notifications
You must be signed in to change notification settings - Fork 263
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
CBMC crash if CPROVER_loop_entry is used inside an assertion inside a loop #8453
Comments
Example code here: In that directory
yields
|
|
Why is it not permitted? I see no reason that it should not be allowed and work fine within an assertions that is within a loop. This form works perfectly well in SPARK, so what is the technical reason that CBMC should not allow it? |
Currently, we create a snapshot upon the entry of loop/function for each history variable we found in the contracts, and replace them with the snapshot variable. This happen when we apply contracts during Also, what the loop_entry of a variable referring to could be confusing in the cases of nested loops.
We may need a general history variable function |
Ah yes... I can see the nesting issue... same in SPARK, where a loop can be optionally labelled with a name, and the "Loop_Entry" attribute can state the name. Without the name, it means "most closely enclosing loop statement." See section 5.5.3.1 here for all the rules: I also see how this would be problematic if loop_entry was allowed in an assertion in a loop that didn't have an invariant. Perhaps it could be allowed only if the enclosing loop really did have an invariant? |
Yes, this can be done by extending the current Is any proof blocked by the lack of support of loop_entry in assertions? I think maybe we can implement the partial support if it is the case. @tautschnig What do you think? |
I had tried to use loop_entry in an assert to help me debug a failing proof, but it appears that the root cause of that is a related failing loop invariant proof. Once that's resolved, I think the other proofs will sort themselves out, so it's not blocking right now. |
On my test case (linked above), I see no change in behaviour at all from the latest wavefront build of CBMC. Did I miss something? |
No. Sorry I misunderstood your comment above. This issue should not be closed. I also reopened the PR #8456. |
CBMC version: 6.2.0
Operating system: macOS
CBMC crashes if the __CPROVER_loop_entry() contract is used inside a __CPROVER_assert()
contract that is within a loop body.
Is this usage legal or not? It should either work, or should result in a clear error message.
Example code to follow.
The text was updated successfully, but these errors were encountered: