-
Notifications
You must be signed in to change notification settings - Fork 284
Fix loop-to-assume transformation in goto-symex #5455
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
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.
Yep; that looks like the kind of fix that is needed. Are there already tests for the kind of loop it is supposed to target?
smowton
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.
Are you sure your test case exercises the new code? I'd expect the first loop to leave count == 5 in the constant propagator. Then the second loop (the empty do-while) would use the empty-loop special case, but the third loop would probably be skipped by plain constant propagation evaluating the conditional jump statically before we consider if it's an empty loop?
|
(Either way it'd be worth adding comments to the test-case indicating what you expect to happen) |
|
@smowton This definitely fixes the reported issue |
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 (the way I understood this this previously replaced all empty or seemingly “empty” loops with assume false, and now only does if the loop condition can be simplified to true?).
smowton
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.
OK, if you're sure it works as advertised
Well, now at least it is being tested... |
The previous implementation (from e672e0d) would not account for loop heads with side effects. Also, no tests existed for this transformation, which are now added. Fixes: diffblue#5450
Codecov Report
@@ Coverage Diff @@
## develop #5455 +/- ##
========================================
Coverage 68.23% 68.23%
========================================
Files 1178 1178
Lines 97588 97590 +2
========================================
+ Hits 66589 66592 +3
+ Misses 30999 30998 -1
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
The previous implementation (from e672e0d) would not account for
loop heads with side effects.
Fixes: #5450