-
Notifications
You must be signed in to change notification settings - Fork 273
Skip phi assignment if one of the merged states has an uninitialised object [blocks: #35, #2574, #3486] #2220
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.
Should rename the PR? Since #2168 has landed in the meantime this is really just a cleanup now I think?
Not entirely: the implementation in #2168 did not yet consider the case that neither branch had SSA level2 at zero, which would occur with uninitialized globals, hence the argc/argv/envp fix in this PR before doing the "cleanup" part. |
Aha, in that case can we have a test to exhibit the change here? |
Cool, in that case lgtm |
c82bfd7
to
ec8c07c
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.
Passed Diffblue compatibility checks (cbmc commit: ec8c07c).
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.
A couple of clang-format complaints, otherwise good to go.
@tautschnig is there a reason you dropped this? Looks good to go AFAICT. There were a couple of spurious Travis failures that I just restarted. |
ea7c5c1
to
3f7757e
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.
✔️
Passed Diffblue compatibility checks (cbmc commit: 2311826).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/90528381
7359f23
to
c7f9d6e
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.
✔️
Passed Diffblue compatibility checks (cbmc commit: c7f9d6e).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/90998307
c7f9d6e
to
124c7ff
Compare
124c7ff
to
8f1745d
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.
✔️
Passed Diffblue compatibility checks (cbmc commit: 8f1745d).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/93272998
8f1745d
to
04d5957
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.
✔️
Passed Diffblue compatibility checks (cbmc commit: 04d5957).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/93794605
04d5957
to
72f3bea
Compare
This now fixes even more bugs with fewer changes. |
src/goto-symex/symex_goto.cpp
Outdated
{ | ||
rhs = dest_state_rhs; | ||
if(goto_count == 0) |
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.
Note the dest_count == 0 && goto_count == 0
case is forbidden above, so this implies `dest_state.guard.is_false() && dest_count != 0) -- not sure if this can be distangled to make that clearer, or perhaps clarify with 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.
If dest_state.guard.is_false()
then really we don't care about dest_count
, because it sits on a dead branch. Any idea what you'd like the comment to say?
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.
How about just pulling out
if(
(dest_state.guard.is_false() && goto_count == 0) ||
(goto_state.guard.is_false() && dest_count == 0))
{
return;
}
It does mean testing is_false()
multiple times, but it makes it clearer which cases are possible. Comment-wise, I guess we should add something like // If the symbol is not initialised on one path and the other path is unreachable we don't need to generate anything
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.
Mind taking another look at the latest version of this PR? Your comments helped make clear which change fixes which bug!
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: 72f3bea).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/95266652
72f3bea
to
6184ab0
Compare
In 646cf29, initialisation of dynamic objects was added, but extern symbols were not considered. Includes a test that fails without this fix.
…object With level-2 counters incremented on declaration and non-deterministic initialisation upon allocation, the only remaining sources are pointer dereferencing, where uninitialised objects necessarily refer to invalid objects. This is a cleaner implementation of 369f077. Removing only the code introduced in 369f077 would yield a wrong result for regression/cbmc/Local_out_of_scope3. Fixes: diffblue#1630
6184ab0
to
eaa7d93
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.
Looks good! I have a feeling the previous version used !is_not_nil()
where the current one uses is_not_nil()
(without the !
), so double-check that?
Well, one of them did... - which was a bug... |
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: eaa7d93).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/95298901
With level-2 counters incremented on declaration and non-deterministic
initialisation upon allocation, the only remaining sources are pointer
dereferencing, where uninitialised objects necessarily refer to invalid objects.
This is a cleaner implementation of 369f077.
This is another bit factored out from #35.