Skip to content

SMT2 backend: remove byte operators before calling find_symbols - #4379

Merged
smowton merged 3 commits into
diffblue:developfrom
smowton:smowton/fix/smt2-lower-byte-update-before-find-symbols
Mar 15, 2019
Merged

smowton merged 3 commits into
diffblue:developfrom
smowton:smowton/fix/smt2-lower-byte-update-before-find-symbols

Conversation

@smowton

@smowton smowton commented Mar 13, 2019 •

Copy link
Copy Markdown
Contributor

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.

@smowton
smowton force-pushed the smowton/fix/smt2-lower-byte-update-before-find-symbols branch 5 times, most recently from 25b90c1 to 7a3f22e Compare March 14, 2019 09:29

@allredj allredj left a comment

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.

@smowton

smowton commented Mar 14, 2019

Copy link
Copy Markdown
Contributor Author

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

Comment thread src/solvers/smt2/smt2_conv.cpp Outdated
return lowered_expr;
}

exprt smt2_convt::prepare_expr(const exprt &expr)

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.

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

@allredj allredj left a comment

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.

@tautschnig

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

@tautschnig tautschnig left a comment

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.

+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

smowton commented Mar 14, 2019

Copy link
Copy Markdown
Contributor Author

Checked; found 4 tests now working.

@allredj allredj left a comment

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.

⚠️
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.

@allredj allredj left a comment

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.

@tautschnig

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

smowton commented Mar 15, 2019

Copy link
Copy Markdown
Contributor Author

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