Skip to content

Fix value-set make_member function #3570

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

Conversation

smowton
Copy link
Contributor

@smowton smowton commented Dec 14, 2018

Fixes #3569; depends on #3562, which is the first commit in this PR.

Previously value_sett would simplify ((struct A)x).y into x.y regardless of whether the two structures both have a member y, or whether it is colocated in the two types. Improve the simplifier slightly to tackle this case, then use it rather than implement custom logic in value_sett.

@smowton smowton changed the title Smowton/fix/value set member type safety Fix value-set make_member function Dec 15, 2018
@smowton smowton force-pushed the smowton/fix/value-set-member-type-safety branch from 26626ad to 142cafe Compare December 17, 2018 13:16
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: 142cafe).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/94978728

@smowton smowton force-pushed the smowton/fix/value-set-member-type-safety branch from 142cafe to 9d6260f Compare December 17, 2018 15:06

return std::move(member_expr);
return member_expr;
Copy link
Collaborator

Choose a reason for hiding this comment

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

I believe this should stay as return std::move(member_expr);

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not so! It's type now matches the return type, so I leave it out and enable RVO. I hope a forthcoming version of C++ renders this distinction unnecessary...

Copy link
Collaborator

Choose a reason for hiding this comment

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

Oops, sorry, I ignored that you had used exprt member_expr ....

@tautschnig tautschnig assigned smowton and unassigned tautschnig Dec 17, 2018
…r casts

This signals that the cast is cleaner than a general byte-extract a little more clearly
Previously this would simplify ((struct A)x).y into x.y regardless of whether the two
structures both have a member y, or whether it is colocated in the two types. Now that
the simplifier can soundly simplify such an expression we should just use that instead.
Now that value-set soundly simplifies member-of-cast-of-struct, this test works as expected.
This also improves the specificity of the two tests in this directory.

This is disabled under SMT2 for the same reason as the existing test.desc -- it involves a
struct-to-struct cast, which SMT2's `convert_typecast` doesn't handle yet.
@smowton smowton force-pushed the smowton/fix/value-set-member-type-safety branch from 9d6260f to 8d88c97 Compare December 17, 2018 15:20
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: 8d88c97).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/94987938

@smowton smowton merged commit 0a21a31 into diffblue:develop Dec 17, 2018
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