Skip to content
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/smt2 #2963

Merged

Conversation

danpoe
Copy link
Contributor

@danpoe danpoe commented Sep 14, 2018

No description provided.

@danpoe danpoe force-pushed the refactor/error-handling-solvers-smt2 branch 4 times, most recently from e5b5a69 to 6c4e483 Compare September 17, 2018 16:05
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: 6c4e483).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/85042148

Copy link
Collaborator

@tautschnig tautschnig left a comment

Choose a reason for hiding this comment

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

Mostly small issues; some of my comments repeat a couple of times, which really begs the question whether such code should be factored out.

@@ -125,30 +125,31 @@ optionalt<Target> numeric_cast(const exprt &arg)
}

/// Convert an mp_integer to integral type Target
/// An invariant with fail with message "Bad conversion" if conversion
/// is not possible.
/// An invariant with fail if the conversion is not possible.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Not actually your fault, but as you are touching this line: s/with/will/

return *maybe;
}

/// Convert an expression to integral type Target
/// An invariant with fail with message "Bad conversion" if conversion
/// is not possible.
/// An invariant with fail if the conversion is not possible.
Copy link
Collaborator

Choose a reason for hiding this comment

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

As above: s/with/will/

mp_integer i;
if(to_integer(expr.op1(), i))
INVALIDEXPR("byte_update takes constant as second parameter");
mp_integer i = numeric_cast_v<mp_integer>(expr.op1());
Copy link
Collaborator

Choose a reason for hiding this comment

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

Use .offset() instead of .op1()

out << '|' << convert_identifier("nondet_"+id2string(id)) << '|';
}
else if(expr.id()==ID_smt2_symbol)
{
irep_idt id=expr.get(ID_identifier);
DATA_INVARIANT(!id.empty(), "smt2_symbol must have identifier");
irep_idt id = to_smt2_symbol(expr).get_identifier();
Copy link
Collaborator

Choose a reason for hiding this comment

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

While at it: const irep_idt &id

assert(datatype_map.find(expr.type())!=datatype_map.end());
INVARIANT(
datatype_map.find(bitnot_expr.type()) != datatype_map.end(),
"type shall have been mapped to Z3 datatype");
Copy link
Collaborator

Choose a reason for hiding this comment

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

Z3?

Copy link
Contributor Author

@danpoe danpoe Sep 20, 2018

Choose a reason for hiding this comment

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

Data types are currently only used when Z3 is used, but it now seems to be a standard SMTLIB feature. I've removed the invariants checking whether the element is in the map followed by a find() by a single call to at().

assert(datatype_map.find(type)!=datatype_map.end());
INVARIANT(
datatype_map.find(type) != datatype_map.end(),
"type should have been mapped to Z3 datatype");
Copy link
Collaborator

Choose a reason for hiding this comment

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

Z3?

assert(datatype_map.find(type)!=datatype_map.end());
INVARIANT(
datatype_map.find(type) != datatype_map.end(),
"type should have been mapped to Z3 datatype");
Copy link
Collaborator

Choose a reason for hiding this comment

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

Z3?

assert(datatype_map.find(type)!=datatype_map.end());
INVARIANT(
datatype_map.find(type) != datatype_map.end(),
"type should have been converted to Z3 datatype");
Copy link
Collaborator

Choose a reason for hiding this comment

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

Z3?

assert(datatype_map.find(type)!=datatype_map.end());
INVARIANT(
datatype_map.find(type) != datatype_map.end(),
"type should have been converted to Z3 datatype");
Copy link
Collaborator

Choose a reason for hiding this comment

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

Z3?

assert(datatype_map.find(type)!=datatype_map.end());
INVARIANT(
datatype_map.find(type) != datatype_map.end(),
"type should have been converted to Z3 datatype");
Copy link
Collaborator

Choose a reason for hiding this comment

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

Z3?

@danpoe danpoe force-pushed the refactor/error-handling-solvers-smt2 branch 3 times, most recently from 244316c to b0f5db1 Compare September 20, 2018 15:05
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.

This PR failed Diffblue compatibility checks (cbmc commit: f88fcae).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/85440531
Status will be re-evaluated on next push.
Please contact @peterschrammel, @thk123, or @allredj for support.

Common spurious failures:

  • the cbmc commit has disappeared in the mean time (e.g. in a force-push)
  • the author is not in the list of contributors (e.g. first-time contributors).

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.

This PR failed Diffblue compatibility checks (cbmc commit: 244316c).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/85443417
Status will be re-evaluated on next push.
Please contact @peterschrammel, @thk123, or @allredj for support.

Common spurious failures:

  • the cbmc commit has disappeared in the mean time (e.g. in a force-push)
  • the author is not in the list of contributors (e.g. first-time contributors).

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: b0f5db1).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/85448831

@danpoe danpoe force-pushed the refactor/error-handling-solvers-smt2 branch from b0f5db1 to 0f6b06c Compare September 28, 2018 17:35
@tautschnig tautschnig merged commit 762f505 into diffblue:develop Sep 28, 2018
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: 0f6b06c).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/86324852

@danpoe danpoe deleted the refactor/error-handling-solvers-smt2 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.

3 participants