Skip to content

SMT2 backend: remove byte operators before calling find_symbols #4379

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

smowton
Copy link
Contributor

@smowton smowton commented Mar 13, 2019

convert_expr assumes that find_symbols has already made an entry for every array_exprt, but byte operator lowering can introduce new ones. Therefore run it up front.

The particular construction (depth-iterator plus recursion) is a bit ugly -- this is required because (a) we must keep the post-order strategy or we expose other bugs (see #4380) and (b) expr_iterator.h is broken when expressions are mutated and then the iterator is permitted to visit those mutated parts, despite the design intending this feature. I suggest we get this fix in and then tackle those two individually, particularly as this blocks other PRs.

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

@smowton
Copy link
Contributor Author

smowton commented Mar 14, 2019

If you want rid of the expr-iterator workarounds, merge #4385 first

return lowered_expr;
}

exprt smt2_convt::prepare_expr(const exprt &expr)
Copy link
Contributor

Choose a reason for hiding this comment

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

Please document this function. Also a better name than prepare_expr would be helpful.
I am a bit surprised this and lower_byte_operators_rec are not const, and if they could be made static this would be better, in particular you could avoid exposing auxiliary functions in the header.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Documented and renamed. The whole class uses member functions to pass the namespace around -- I won't get into changing that in this PR.

@smowton smowton force-pushed the smowton/fix/smt2-lower-byte-update-before-find-symbols branch from 7a3f22e to a1cfbb5 Compare March 14, 2019 11:09
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: a1cfbb5).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/104411418

@tautschnig
Copy link
Collaborator

Did you by any chance check whether this also fixes other tests currently marked "broken-smt-backend"? I think there's a fair chance that it does.

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.

+1 for getting #4385 merged first, and then please also take a look whether these fixes resolve even more problems with existing tests as just said.

@smowton smowton force-pushed the smowton/fix/smt2-lower-byte-update-before-find-symbols branch from e623944 to 01877d1 Compare March 14, 2019 17:08
@smowton
Copy link
Contributor Author

smowton commented Mar 14, 2019

Checked; found 4 tests now working.

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: e623944).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/104457441
Status will be re-evaluated on next push.
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).

  • the compatibility was already broken by an earlier merge.

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

@tautschnig
Copy link
Collaborator

It seems that union6 and union7 are still failing on Windows.

smowton added 3 commits March 15, 2019 10:14
Otherwise the lowering can introduce new array expressions, which the SMT2 backend's convert_expr
expects to have been pre-converted into auxiliary symbols.
If the input expression used a union tag, keep that in the result.
@smowton smowton force-pushed the smowton/fix/smt2-lower-byte-update-before-find-symbols branch from 01877d1 to 0411ef8 Compare March 15, 2019 10:14
@smowton
Copy link
Contributor Author

smowton commented Mar 15, 2019

Returned the still-broken tests to their prior state; rebased to use the now-working depth-iterator.

@smowton smowton merged commit 7d88715 into diffblue:develop Mar 15, 2019
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.

4 participants