-
Notifications
You must be signed in to change notification settings - Fork 274
Error handling cleanup in solvers/flattening 3 #2933
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
Error handling cleanup in solvers/flattening 3 #2933
Conversation
@@ -12,6 +12,8 @@ Author: Daniel Kroening, [email protected] | |||
|
|||
bvt boolbvt::convert_mult(const exprt &expr) | |||
{ | |||
PRECONDITION(expr.id() == ID_mult || expr.id() == "no-overflow-mult"); |
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 "no-overflow-mult"
still used? It does not seem to be assigned anywhere. If not, we can remove it and make convert_mult
take a mult_exprt
instead.
@@ -173,18 +174,23 @@ literalt boolbvt::convert_overflow(const exprt &expr) | |||
else if(has_prefix(expr.id_string(), "overflow-typecast-")) |
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 "overflow-typecast-"
still used? It's not assigned anywhere.
@@ -11,6 +11,8 @@ Author: Daniel Kroening, [email protected] | |||
|
|||
literalt boolbvt::convert_onehot(const unary_exprt &expr) | |||
{ | |||
PRECONDITION(expr.id() == ID_onehot || expr.id() == ID_onehot0); |
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.
Are those expressions used anywhere? The IDs are not assigned anywhere.
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.
They are used in ebmc.
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.
Raised an issue for those as well: #3040
throw "mult without operands"; | ||
DATA_INVARIANT( | ||
!operands.empty(), | ||
"multiplication must have operands"); | ||
|
||
const exprt &op0=expr.op0(); | ||
|
||
bool no_overflow=expr.id()=="no-overflow-mult"; |
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 can be removed then too.
else | ||
throw "unexpected onehot expression"; | ||
{ | ||
INVARIANT(expr.id() == ID_onehot0, ""); |
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.
message missing
@@ -11,6 +11,8 @@ Author: Daniel Kroening, [email protected] | |||
|
|||
literalt boolbvt::convert_onehot(const unary_exprt &expr) | |||
{ | |||
PRECONDITION(expr.id() == ID_onehot || expr.id() == ID_onehot0); |
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.
They are used in ebmc.
@@ -173,18 +174,23 @@ literalt boolbvt::convert_overflow(const exprt &expr) | |||
else if(has_prefix(expr.id_string(), "overflow-typecast-")) | |||
{ | |||
std::size_t bits=unsafe_string2unsigned(id2string(expr.id()).substr(18)); | |||
INVARIANT( | |||
bits != 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.
missing message
throw "overflow-typecast got wrong number of bits"; | ||
INVARIANT( | ||
bits < bv.size(), | ||
""); |
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.
missing message
6160036
to
08b7bc0
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: 08b7bc0).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/85552876
Files boolbv_map.cpp to boolbv_overflow.cpp
08b7bc0
to
d57737a
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: d57737a).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/85868517
|
||
const exprt &op=operands[0]; | ||
|
||
const bvt &bv=convert_bv(op); | ||
|
||
if(bits>=bv.size() || bits==0) | ||
throw "overflow-typecast got wrong number of bits"; | ||
INVARIANT(bits < bv.size(), ""); |
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.
Missing message
@@ -173,18 +173,19 @@ literalt boolbvt::convert_overflow(const exprt &expr) | |||
else if(has_prefix(expr.id_string(), "overflow-typecast-")) | |||
{ | |||
std::size_t bits=unsafe_string2unsigned(id2string(expr.id()).substr(18)); | |||
INVARIANT(bits != 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.
Missing message
@tautschnig @peterschrammel I think this is ready to be merged. |
No description provided.