-
Notifications
You must be signed in to change notification settings - Fork 273
Assert type consistency in the simplifier #2064
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2548,6 +2548,7 @@ bool simplify_exprt::simplify_rec(exprt &expr) | |
|
||
if(!result) | ||
{ | ||
POSTCONDITION(tmp.type() == expr.type()); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We are hitting this invariant - will try to produce a jbmc version of the crash at some point today. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok, that's another bug in the simplifier then or some weird expression being passed in. Some of the bug fixes already in this PR are a consequence of adding this invariant. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The problem is we've simplified something that has type I've never really be clear whether this transformation ( There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In this PR I've made a few changes to the simplifier to restore the original type when So what it would take is tracking down what simplification is being performed and then fix this in the same way it's already being done several times in this PR. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I can't reproduce this yet on JBMC as failing example seems to depend on a model for There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Found it - tautschnig#7 - will verify fixes other issues. You might have some insight on how to create a regression that demonstrates this on the CBMC side? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A test should look like this, except it doesn't really do the job right now, because the update to
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There appears to be more - will investigate these as well. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ignore previous, appears to be PEBKAC. TG pointer updated - will post if passed. Re regression - in our previously broken example, it is simplified to a null pointer, so perhaps assigning There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nope - works before and after using |
||
expr.swap(tmp); | ||
|
||
#ifdef USE_CACHE | ||
|
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 will probably not get rid of all the inconsistencies, so I'm not sure about how useful it is. Ideally we should get rid of the introduction of type inconsistencies, but I'm not sure about the best way to do that.
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 recall having tried removing them completely (which would be done by using type casts), but that did not seem to work very well. It's the long-term solution, and maybe that's what we should actually invest in instead of this hack. Not sure though, I'm certainly curious about the results with TG!
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.
Everything is green on our side, so nothing blocking merging it.