Skip to content

Bugfix in bdd::as_expr #4279

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

Merged
merged 2 commits into from
Feb 25, 2019
Merged

Conversation

romainbrenguier
Copy link
Contributor

There was a bug in the as_expr method. I also added a unit test that should fail without the fix.

  • Each commit message has a non-empty body, explaining why the change was made.
  • Methods or procedures I have added are documented, following the guidelines provided in CODING_STANDARD.md.
  • The feature or user visible behaviour I have added or modified has been documented in the User Guide in doc/cprover-manual/
  • Regression or unit tests are included, or existing tests cover the modified code (in this case I have detailed which ones those are in the commit message).
  • My commit message includes data points confirming performance improvements (if claimed).
  • My PR is restricted to a single feature or bugfix.
  • White-space or formatting changes outside the feature-related changed lines are in commits of their own.

There was a mistake in the way complement is computed when going to the
then_branch.
{
const bool correct = result == and_exprt(a, not_exprt(b)) ||
result == and_exprt(not_exprt(b), a);
REQUIRE(correct);
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'd break this up into four REQUIRE statements to obtain more meaningful output in case of failure:

REQUIRE(result.id() == ID_and);
REQUIRE(result.operands().size() == 2);
REQUIRE(result.op0() == a || result.op1() == a);
REQUIRE(result.op0() == not_exprt(b) || result.op1() == not_exprt(b));

@tautschnig
Copy link
Collaborator

It's actually failing CI, though...

This adds a test case to check there are no mistakes in the BDD to expr
conversions.
This test can fail without the previous fix.
@romainbrenguier
Copy link
Contributor Author

@tautschnig fixed

@tautschnig tautschnig merged commit e50449d into diffblue:develop Feb 25, 2019
@romainbrenguier romainbrenguier deleted the bugfix/bdd_as_expr branch February 25, 2019 18:23
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: e1fb6b7).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/102204954

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