Skip to content

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

Conversation

danpoe
Copy link
Contributor

@danpoe danpoe commented Sep 11, 2018

No description provided.

@@ -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");
Copy link
Contributor Author

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-"))
Copy link
Contributor Author

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);
Copy link
Contributor Author

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.

Copy link
Member

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.

Copy link
Contributor Author

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";
Copy link
Member

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, "");
Copy link
Member

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);
Copy link
Member

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,
"");
Copy link
Member

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(),
"");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing message

@danpoe danpoe force-pushed the refactor/error-handling-solvers-flattening-from-boolbv-map branch from 6160036 to 08b7bc0 Compare September 21, 2018 11:08
Copy link
Contributor

@allredj allredj left a 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

@danpoe danpoe force-pushed the refactor/error-handling-solvers-flattening-from-boolbv-map branch from 08b7bc0 to d57737a Compare September 25, 2018 12:41
Copy link
Contributor

@allredj allredj left a 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(), "");
Copy link
Collaborator

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, "");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing message

@danpoe
Copy link
Contributor Author

danpoe commented Sep 28, 2018

@tautschnig @peterschrammel I think this is ready to be merged.

@peterschrammel peterschrammel removed their assignment Sep 28, 2018
@tautschnig tautschnig merged commit 755d839 into diffblue:develop Sep 28, 2018
@danpoe danpoe deleted the refactor/error-handling-solvers-flattening-from-boolbv-map branch June 2, 2020 17:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants