Skip to content

check for side effects in quantifiers#2979

Merged
tautschnig merged 1 commit intodevelopfrom
quantifier-sideeffects
Sep 26, 2018
Merged

check for side effects in quantifiers#2979
tautschnig merged 1 commit intodevelopfrom
quantifier-sideeffects

Conversation

@kroening
Copy link
Copy Markdown
Collaborator

@kroening kroening commented Sep 18, 2018

  • Each commit message has a non-empty body, explaining why the change was made.
  • My contribution is formatted in line with CODING_STANDARD.md.
  • Methods or procedures I have added are documented, following the guidelines provided in CODING_STANDARD.md.
  • 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.

// g2 = (i > 10)
// forall (i : int) (g1 || g2)
if(expr.id()==ID_forall || expr.id()==ID_exists)
return false;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The comment above this code needs to be moved, it doesn't actually make sense when these lines are removed.

goto_programt tmp;
clean_expr(expr.op1(), tmp, mode, true);
if(tmp.instructions.empty())
if(!tmp.instructions.empty())
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

So this was dead code before. It's no longer dead code now - do we have any tests exercising it?

@kroening kroening force-pushed the quantifier-sideeffects branch from cc4fae7 to a887387 Compare September 23, 2018 13:06
@kroening
Copy link
Copy Markdown
Collaborator Author

Now with different approach -- the rule is now checked in the front-end

@kroening kroening force-pushed the quantifier-sideeffects branch from a887387 to 0812cc1 Compare September 23, 2018 21:30
Copy link
Copy Markdown
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: 0812cc1).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/85673814

throw 0;
}
return;
// the front-end checks these for side-effects
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Invariant?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

DATA_INVARIANT(!has_subexpr(expr, ID_side_effect), "the front-end should check quantified expressions for side-effects");

Copy link
Copy Markdown
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.

I'd suggest to simplify as described below.

return false;
}

static bool has_side_effect(const exprt &expr)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

No need - see below.

throw 0;
}

if(has_side_effect(expr.op1()))
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

if(has_subexpr(expr.op1(), ID_side_effect))

throw 0;
}
return;
// the front-end checks these for side-effects
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

DATA_INVARIANT(!has_subexpr(expr, ID_side_effect), "the front-end should check quantified expressions for side-effects");

Copy link
Copy Markdown
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.

Looks good, except for the line break.

throw 0;
}
return;
DATA_INVARIANT(!has_subexpr(expr, ID_side_effect), "the front-end should check quantified expressions for side-effects");
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This line got too long.

@tautschnig tautschnig assigned kroening and unassigned tautschnig Sep 26, 2018
Copy link
Copy Markdown
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: f505207).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/85988064

This fixes a failed attempt to check for quantifiers during goto conversion
by checking earlier in the C front-end.
Copy link
Copy Markdown
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: a3fa911).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/86019720

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants