-
Notifications
You must be signed in to change notification settings - Fork 274
allow multiple loop invariants #6214
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
Conversation
This extends the grammar to allow multiple loop invariants for one loop.
888b0c6
to
b06b263
Compare
Codecov Report
@@ Coverage Diff @@
## develop #6214 +/- ##
===========================================
+ Coverage 75.20% 75.37% +0.16%
===========================================
Files 1458 1458
Lines 161311 161367 +56
===========================================
+ Hits 121318 121634 +316
+ Misses 39993 39733 -260
Continue to review full report at Codecov.
|
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.
I think we should also update the side-effect check:
cbmc/src/goto-programs/goto_convert.cpp
Lines 865 to 877 in 3e0007f
exprt invariant = | |
static_cast<const exprt &>(code.find(ID_C_spec_loop_invariant)); | |
exprt decreases_clause = | |
static_cast<const exprt &>(code.find(ID_C_spec_decreases)); | |
if(!invariant.is_nil()) | |
{ | |
if(has_subexpr(invariant, ID_side_effect)) | |
{ | |
throw incorrect_goto_program_exceptiont( | |
"Loop invariant is not side-effect free.", code.find_source_location()); | |
} | |
I see that the PR is now assigned to me / @feliperodri.
Should I make this change and merge the PR, @kroening?
No need to change this code, |
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.
Thanks!! Indeed, has_subexpr
looks at the operands and would work as expected.
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.
This extends the grammar to allow multiple loop invariants for one loop.