-
Notifications
You must be signed in to change notification settings - Fork 284
Add short circuit evaluation to implies operator ==>
#6401
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
Add short circuit evaluation to implies operator ==>
#6401
Conversation
To ensure there are no regressions when adding short-circuiting evaluation for the `==>` operator.
Makes the code easier to read because it puts the values which we care about into the code rather than the comment. As a bonus an UNREACHABLE invariant will be violated if `expr.id()` value which we haven't accounted for is encountered.
So that side effects of the right hand side are only evaluated in the case where the left hand side is true. This allows for pointer checks to be applied to assertions such as `assert(x != NULL ==> *x==2);` for example.
Codecov Report
@@ Coverage Diff @@
## develop #6401 +/- ##
========================================
Coverage 75.97% 75.97%
========================================
Files 1523 1523
Lines 164191 164201 +10
========================================
+ Hits 124748 124758 +10
Misses 39443 39443
Continue to review full report at Codecov.
|
martin-cs
left a comment
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 appreciate that the issue that this addresses is labelled as urgent but I am a little concerned about changing the semantics of an existing operation; that feels like a non-trivial step. I am not sure if the ACSL ==> ( https://frama-c.com/html/acsl.html ) is short-cutting or not; that would give some argument one way or another.
@NlightNFotis this will have very significant consequences for #6399
As I read the ACSL reference manual, it only supports pure expressions. See the first paragraph of section 2.2. If it does not allow side-effects then that would side step the issue of short circuiting or not, for usage of ACSL. Which doesn't really help us either way. |
peterschrammel
left a comment
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 PR adds short circuit evaluation to implies operator
==>, in response to #6319