-
Notifications
You must be signed in to change notification settings - Fork 273
Added support for loop_entry history variable. #6278
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
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.
We need regression tests.
Codecov Report
@@ Coverage Diff @@
## develop #6278 +/- ##
===========================================
- Coverage 75.91% 75.91% -0.01%
===========================================
Files 1514 1514
Lines 163972 163984 +12
===========================================
+ Hits 124476 124485 +9
- Misses 39496 39499 +3
Continue to review full report at Codecov.
|
bbafecd
to
9ec901a
Compare
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 modulo Saswat's comments.
fdaa7d5
to
c514b09
Compare
5359895
to
b662559
Compare
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.
Almost there 😊
b662559
to
4da393c
Compare
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.
There is a bit of code duplication between disallow_loop_history_variables
and disallow_history_variables
.
Can we remove disallow_loop_history_variables
, add an additional argument to disallow_history_variables
which would be the id
of the history variable expressions we want to disallow, and just reuse the code in both contexts?
4da393c
to
fcf4127
Compare
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; LGTM modulo the build issues with CI.
@aalok-thakkar CI failures are due to regex on test descriptions (not compatible with Windows). You also need to run clang-format. |
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 modulo CI failures.
ec46ea2
to
3778757
Compare
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.
Code looks great, but I wonder if I might ask for a couple of extras:
- Some more negative tests - at the moment the regression tests you've added all lead either to VERIFICATION SUCCESSFUL, or CONVERSION ERROR... Could we perhaps have some tests that also lead to verification failure? This might also help with my next point :-)
- This is more optional... but it would be super nice if we could also have a small bit of user documentation for this new predicate... indicating its purpose, how it should be used, etc.
I won't block the review just for missing user documentation, but I think we could do with the extra "negative test" before we merge.
3778757
to
1a2cab1
Compare
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 @chrisr-diffblue!
@aalok-thakkar I don't understand the new test. I think by negative tests Chris was suggesting that we include a test where it would be violated, and we check that CBMC correctly catches it. An example would be:
while(y > 0)
__CPROVER_loop_invariant(x == __CPROVER_loop_entry(x))
{
--y;
x += 1;
x -= 2;
}
}
1a2cab1
to
8e8381c
Compare
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. Thanks for all the fixes, @aalok-thakkar :)
@chrisr-diffblue could you take another look? |
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.
Some issues with pointers.
(They were not caught because the tests are not run with --pointer-check
)
8e8381c
to
29925c6
Compare
The CI failures are due to Minor comment on the commit description: please change |
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.
Approved, pending fixing the issue @SaswatPadhi has mentioned with --pointer-check
5997ed3
to
29b9e1e
Compare
In this commit we introduce a new expression, `__CPROVER_loop_entry`, which can be used within loop invariants to track history of variables. `__CPROVER_loop_entry(x)` returns the initial value of a variable just before the very first iteration of a loop. Co-authored-by: Aalok Thakkar <[email protected]>
29b9e1e
to
f8cca6c
Compare
In this commit we introduce a new expression,
__CPROVER_loop_entry
, which can be used within loop invariants to track history of variables.__CPROVER_loop_entry(x)
returns the initial value of a variable just before the very first iteration of a loop.My commit message includes data points confirming performance improvements (if claimed).White-space or formatting changes outside the feature-related changed lines are in commits of their own.