-
Notifications
You must be signed in to change notification settings - Fork 285
Use expected_width parameter in flattening/boolbv_if to simplify error handling #3043
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
Use expected_width parameter in flattening/boolbv_if to simplify error handling #3043
Conversation
allredj
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.
Passed Diffblue compatibility checks (cbmc commit: 3779e52).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/85890465
src/solvers/flattening/boolbv_if.cpp
Outdated
| const bvt &false_case_bv = convert_bv(expr.false_case()); | ||
|
|
||
| if(op1_bv.size()!=width || op2_bv.size()!=width) | ||
| if(true_case_bv.size() != width || false_case_bv.size() != width) |
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 think width should just be passed as second argument to convert_bv thanks to your earlier work?!
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.
@hannes-steffenhagen-diffblue convert_bv in boolbv.cpp was changed recently to take an optional size. https://github.com/diffblue/cbmc/blob/develop/src/solvers/flattening/boolbv.cpp#L114 That makes the invariant present here as well unnecessary.
NlightNFotis
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.
The data invariant is not needed, just pass the width as an extra argument to convert_bv. The invariant is being enforced inside convert_bv now.
|
Apologies, the changes to |
The second parameter to convert_bv will cause to function to fail if the resulting bitvector doesn't have the width we say it should have. We use this to avoid doing an explicit check in this file.
3779e52 to
2ab7ac7
Compare
|
@NlightNFotis @tautschnig I believe I've addresses your comments, can you rereview? |
NlightNFotis
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.
Looks good to me.
allredj
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.
Passed Diffblue compatibility checks (cbmc commit: 2ab7ac7).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/86025732
Uh oh!
There was an error while loading. Please reload this page.