-
Notifications
You must be signed in to change notification settings - Fork 274
Byte updates using bit fields require extension to full bytes #6448
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
Codecov Report
@@ Coverage Diff @@
## develop #6448 +/- ##
===========================================
- Coverage 76.02% 76.01% -0.02%
===========================================
Files 1546 1546
Lines 165352 165394 +42
===========================================
+ Hits 125711 125723 +12
- Misses 39641 39671 +30
Continue to review full report at Codecov.
|
050dc14
to
4a8b5ec
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 as expected. Fewer tests marked as buggy is always good.
@@ -699,7 +700,7 @@ void goto_convertt::do_havoc_slice( | |||
t->source_location_nonconst().set_comment( | |||
"assertion havoc_slice " + from_expr(ns, identifier, ok_expr)); | |||
|
|||
const array_typet array_type(char_type(), arguments[1]); | |||
const array_typet array_type(char_type(), simplify_expr(arguments[1], ns)); |
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 get that this might be the right thing to do and that it fixes a bug but this doesn't immediately seem linked to the description of the PR.
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.
Thanks, addressed in two ways: 1) I've moved this change to a commit of its own; 2) I've added a comment explaining when a DATA_INVARIANT
newly introduced here could fail (which really was what made me detect the above).
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.
Amazing! Thank you.
The array size may include a type cast, possibly of a constant. Therefore, the size would be found to be constant via simplification, but other ways of computing the size may fail to derive a constant.
A byte update with an update value that has a size that's not a multiple of bytes must not overwrite bits that are not in the update value. We previously generated extractbits expressions that would go out of bounds, which tripped up the SMT solvers. No longer generating these out-of-bounds expressions makes the SMT solvers happy on the Promotion3 test, which exercised this feature.
4a8b5ec
to
eeb1372
Compare
A byte update with an update value that has a size that's not a multiple
of bytes must not overwrite bits that are not in the update value. We
previously generated extractbits expressions that would go out of
bounds, which tripped up the SMT solvers. No longer generating these
out-of-bounds expressions makes the SMT solvers happy on the Promotion3
test, which exercised this feature.