-
Notifications
You must be signed in to change notification settings - Fork 274
Update after remove returns #4151
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
Update after remove returns #4151
Conversation
66e0b75
to
e362c86
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.
🚫
This PR failed Diffblue compatibility checks (cbmc commit: 66e0b75).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/100406202
Status will be re-evaluated on next push.
Please contact @peterschrammel, @thk123, or @allredj for support.
Common spurious failures:
- the cbmc commit has disappeared in the mean time (e.g. in a force-push)
- the author is not in the list of contributors (e.g. first-time contributors).
The incompatibility may have been introduced by an earlier PR. In that case merging this
PR should be avoided unless it fixes the current incompatibility.
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.
✔️
Passed Diffblue compatibility checks (cbmc commit: e362c86).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/100411075
@@ -1447,9 +1443,6 @@ void goto_instrument_parse_optionst::instrument_goto_program() | |||
{ | |||
do_indirect_call_and_rtti_removal(); | |||
|
|||
// recalculate numbers, etc. | |||
goto_model.goto_functions.update(); |
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.
Is this actually still needed, seeing as this follows from do_indirect_call_and_rtti_removal
, not do_return_removal
?
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.
Well, this commit just reverts that earlier change, I don't think it ever was needed.
Note that the location numbers are global, not local to a function. The global update is too expensive to be performed after every transformation. What needs to be done here is to clean up goto_instrument to have a concept of 'steps', which can then imply a next step or require a previous step. |
The proposed change here only does a single-function update, not the global one. It will not ensure globally unique numbers, but will ensure we have increasing numbers per function. We could instead use the facility from
That might work for |
I agree on the pain point entirely. |
The (relatively) easy thing to appears to be to change the location number to be locally unique, not globally. |
Could I suggest passing |
e362c86
to
989ffad
Compare
As removal of location numbers is a larger task that may not be completed in the near future I have followed @smowton's suggestion, which did not require many changes at all. |
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.
Looks good except I think you should remove every occurrence of !
from the PR ;)
src/goto-programs/remove_returns.cpp
Outdated
@@ -142,10 +142,14 @@ void remove_returnst::replace_returns( | |||
/// \param function_is_stub: function (irep_idt -> bool) that determines whether | |||
/// a given function ID is a stub | |||
/// \param goto_program: program to transform | |||
void remove_returnst::do_function_calls( | |||
/// \return False if, and only if, instructions have been inserted. In that case |
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.
Surely returning true if something has been done would be more intuitive? I appreciate there are various cbmc functions using the unix shell "zero = success" pattern, but I don't think this is a success/failure return.
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 couldn't decide... - so I'll happily take the guidance that you and @thk123 provided and will amend this.
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 note the original PR didn't have any tests, so it'd be great if possible to add one here?
I also strongly support @smowton's suggestion to return true if something happened. This is consistent with STL things where returning true indicates that something was inserted in to the set, for example. If also removes all the !
you have to put in at the callsite
To be honest, I have no idea how to create a regression test for this (a unit test would seem possible, of course): In #4147 @kroening claimed that #4001 (which has since been merged) would fail without the fix, but even when using just the revert without the fix I cannot make any test fail. All of the code paths in |
989ffad
to
845d60d
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.
🚫
This PR failed Diffblue compatibility checks (cbmc commit: 845d60d).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/102161974
Status will be re-evaluated on next push.
Please contact @peterschrammel, @thk123, or @allredj for support.
Common spurious failures:
- the cbmc commit has disappeared in the mean time (e.g. in a force-push)
- the author is not in the list of contributors (e.g. first-time contributors).
The incompatibility may have been introduced by an earlier PR. In that case merging this
PR should be avoided unless it fixes the current incompatibility.
@tautschnig The failure was on Windows only, which made it really hard to diagnose. |
The problem with this PR is still that it kills the global uniqueness of the location numbers? |
845d60d
to
db63e03
Compare
I'll try to reproduce it. Marking this PR work-in-progress for the moment.
No, |
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.
✔️
Passed Diffblue compatibility checks (cbmc commit: db63e03).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/102299143
This reverts commit abbb389. In diffblue#2089 a broad cleanup of redundant calls to .update() was done. Let's stay in this spirit and call .update() when necessary, and not "just to be safe."
remove_returnst::do_function_calls may introduce new instructions. Doing so requires a call to compute_location_numbers to ensure instruction numbers are assigned. To avoid recomputing location numbers across all goto functions, the facility from goto_functionst is used, which will ensure globally unique location numbers (though they might not be globally contiguous).
db63e03
to
cdab267
Compare
It seems that removing the bug fix does not actually make any tests fail. I'll refrain from doing more debugging as certainly there is a possible problem, but we seemingly have a number of mitigations in place. Putting this PR back in ready-for-review. |
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.
✔️
Passed Diffblue compatibility checks (cbmc commit: cdab267).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/102315448
This reverts #4147 and instead introduces a local update. This yields a much simpler protocol, as the size of the change also shows.