Skip to content

vector_typet::size() is now a constant_exprt #4007

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 2 commits into from
Feb 1, 2019
Merged

Conversation

kroening
Copy link
Member

The codebase assumes basically globally that vector_typet::size() is a
constant_exprt. This is now enforced by the signature.

  • 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/
  • 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.

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.

I'm pretty sure this requires further changes in the code base, but of course the stricter type enforcement is good.

: type_with_subtypet(ID_vector, _subtype)
{
size() = _size;
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

What's the rationale to move these to the .cpp file?

Copy link
Member Author

Choose a reason for hiding this comment

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

constant_exprt isn't complete -- there's a cyclic dependency between std_types.h and std_expr.h.

@tautschnig tautschnig assigned kroening and unassigned tautschnig Jan 31, 2019
@kroening
Copy link
Member Author

@tautschnig The problem is that there's a period of time in both front-ends where the expression isn't yet turned into a constant. I might have to introduce s.th. like unfinished_vector_typet or the like.

@kroening
Copy link
Member Author

kroening commented Feb 1, 2019

Added ID_frontend_vector, similar to ID_frontend_pointer, for the type that's yet to be finished.

Daniel Kroening added 2 commits February 1, 2019 17:56
This enables distinguishing the case of a size that is an arbitary
expression from the case where the size is required to be constant.
The codebase assumes basically globally that vector_typet::size() is a
constant_exprt.  This is now enforced by the signature.
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: 41e4913).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/99471857

@kroening kroening merged commit 4dc7725 into develop Feb 1, 2019
@kroening kroening deleted the vector_typet_size branch February 1, 2019 21:03
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