Skip to content

goto_symex: rename type symbols only when needed [blocks: #3652] #3633

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 5 commits into from
Jan 24, 2019

Conversation

kroening
Copy link
Member

  • Each commit message has a non-empty body, explaining why the change was made.
  • n/a Methods or procedures I have added are documented, following the guidelines provided in CODING_STANDARD.md.
  • n/a The feature or user visible behaviour I have added or modified has been documented in the User Guide in doc/cprover-manual/
  • n/a 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).
  • n/a My commit message includes data points confirming performance improvements (if claimed).
  • My PR is restricted to a single feature or bugfix.
  • n/a White-space or formatting changes outside the feature-related changed lines are in commits of their own.

@kroening kroening changed the title Symex type renaming3 @kroening goto_symex: rename type symbols only when needed Dec 28, 2018
@kroening kroening changed the title @kroening goto_symex: rename type symbols only when needed goto_symex: rename type symbols only when needed Dec 28, 2018
@kroening
Copy link
Member Author

This fails on jbmc regressions -- apparently types created by the Java object factory are sometimes expanded to ID_struct.

@tautschnig
Copy link
Collaborator

This fails on jbmc regressions -- apparently types created by the Java object factory are sometimes expanded to ID_struct.

This might as well be something that the simplifier does. See some of the commits in #2064.

!array_type.size().is_constant();
}
else if(
type.id() == ID_struct || type.id() == ID_union || type.id() == ID_class)
Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't think type.id() == ID_class should ever evaluate to true. A class is represented as ID_struct with ID_C_class set to true. If I'm wrong in saying this then we've got a lot more work to do elsewhere.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, these should be cleaned out.

Copy link
Member Author

Choose a reason for hiding this comment

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

@kroening
Copy link
Member Author

Note #3634 -- the assertion there catches this problem.

@tautschnig
Copy link
Collaborator

I think it would be good to factor out the individual commits into PRs of their own. They need proper justifications, but seem to be useful in their own right. And also at least the first one also appears in another PR.

@kroening
Copy link
Member Author

The bugfixes are now in separate PRs.
For this to work in jbmc, the problem in the Java object factory needs to be fixed first, as part of #3634.

@tautschnig
Copy link
Collaborator

@kroening Are all the depended-on changes now PR'ed, or is there more work necessary?

@tautschnig tautschnig changed the title goto_symex: rename type symbols only when needed goto_symex: rename type symbols only when needed [blocks: #3652] Jan 10, 2019
@kroening kroening force-pushed the symex-type-renaming3 branch from db3ebcb to 649abde Compare January 11, 2019 09:02
@kroening kroening force-pushed the symex-type-renaming3 branch from 649abde to 41c7d83 Compare January 19, 2019 13:01
@tautschnig tautschnig force-pushed the symex-type-renaming3 branch from 41c7d83 to 4949535 Compare January 23, 2019 16:05
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.

Approving, but this PR now includes commits of my own so @kroening (and other reviewers as other code is now being touched) should please comment as well.

@smowton
Copy link
Contributor

smowton commented Jan 23, 2019

Any chance of unifying the make-change and check-if-change-needed paths? For example, by passing a const typet & and a typet * in parallel, which is null in the check-if-needed case and non-null otherwise?

tautschnig and others added 5 commits January 23, 2019 18:12
Just like symbol or enum tags, we need to look into the expanded tags.
The regular expressions now accept both the tag names as well as the expanded
types/class names.
Until we have resolved partial tag expansion everywhere we need to use
base_type_eq for cases where both tags and expanded types may occur.
Renaming a type is rarely needed: this is necessary only if the type
contains a struct that contains a variable-sized member, which is a gcc
extension.  The key benefit of not renaming in all other cases is that
struct and union tag types no longer get expanded.
@tautschnig tautschnig force-pushed the symex-type-renaming3 branch from abd6508 to 74d1548 Compare January 23, 2019 18:13
@tautschnig
Copy link
Collaborator

Any chance of unifying the make-change and check-if-change-needed paths?

Good point, but I'm a bit hesitant here: not doing the renaming also spares us putting anything in l1_types, which we'd otherwise likely want to be doing lookups in. Doable, but I'd for now prefer to keep this one simple until profiling tells us that it is one of the bottlenecks worth tackling.

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

{
// be careful, or it might get cyclic
if(component.type().id() != ID_pointer)
return requires_renaming(component.type(), ns);
Copy link
Contributor

Choose a reason for hiding this comment

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

This only looks at the first non-pointer component of the struct, which is strange, but I cannot say whether this is correct because the function is not documented, so please document.

Copy link
Contributor

Choose a reason for hiding this comment

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

Oooh, I missed that, @kroening pretty sure this is a real bug

Copy link
Contributor

Choose a reason for hiding this comment

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

(suggests a new test -- AFAIK GCC allows such variable-size structs?)

Copy link
Collaborator

@tautschnig tautschnig Jan 24, 2019

Choose a reason for hiding this comment

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

I think I've found a way to construct a failing test, I'll post a follow-up PR to include a test, a fix, and the suggested documentation.

Copy link
Collaborator

Choose a reason for hiding this comment

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

The failure I thought I had found was one caused by integer overflow - I haven't actually managed to produce a proper failure. See #3918 for my attempt and the cleanup.

@kroening
Copy link
Member Author

The base_type_eq shouldn't be needed; however, this is a step in the right direction.

@kroening kroening merged commit 8c1ae4c into develop Jan 24, 2019
@kroening kroening deleted the symex-type-renaming3 branch January 24, 2019 13:40
@tautschnig
Copy link
Collaborator

The base_type_eq shouldn't be needed; [...]

Yes, it shouldn't be, but thus far it strictly is needed for Java input programs (as regression tests confirm).

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.

5 participants