Skip to content

Use numeric_cast<mp_integer> instead of deprecated to_integer(exprt) #3252

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 1 commit into from
Nov 3, 2018

Conversation

tautschnig
Copy link
Collaborator

This reduces the number of warnings flagged, in particular in Visual-Studio
builds.

  • 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.
  • 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.
  • White-space or formatting changes outside the feature-related changed lines are in commits of their own.

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

return nil_exprt();
}
const mp_integer vector_size =
numeric_cast_v<mp_integer>(vector_type.size());

Copy link
Member

Choose a reason for hiding this comment

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

This is a change in behavior -- intended?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, my apologies for not noting that in the commit message (which I have now done). In several places we had already treated vectors having constant size as an invariant. This should add consistency.

@@ -124,15 +120,10 @@ pointer_offset_bits(const typet &type, const namespacet &ns)
return {};

// get size
const exprt &size=to_vector_type(type).size();
const mp_integer size =
numeric_cast_v<mp_integer>(to_vector_type(type).size());

Copy link
Member

Choose a reason for hiding this comment

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

Same here?

This reduces the number of warnings flagged, in particular in Visual-Studio
builds. Also turn tests of the size of ID_vector types being constants into
invariants as was already done in some places.
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: 638d91c).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/90146796
Status will be re-evaluated on next push.
Please contact @peterschrammel, @thk123, or @allredj for support.

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 incompatibility may have been introduced by an earlier PR. In that case merging this
PR should be avoided unless it fixes the current incompatibility.

@kroening kroening merged commit 3028bf8 into diffblue:develop Nov 3, 2018
@tautschnig
Copy link
Collaborator Author

Could someone with sufficient access please take a look as this may have broken TG?

@tautschnig tautschnig deleted the vs-no-to_integer branch November 3, 2018 11:24
@smowton
Copy link
Contributor

smowton commented Nov 5, 2018

Looked like a post-build network-related failure, but restarted the build to make sure

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: 638d91c).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/90146796
Status will be re-evaluated on next push.
Please contact @peterschrammel, @thk123, or @allredj for support.

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 incompatibility may have been introduced by an earlier PR. In that case merging this
PR should be avoided unless it fixes the current incompatibility.

@smowton
Copy link
Contributor

smowton commented Nov 5, 2018

Failure is real but also present on current test-gen/develop, so nothing to worry about here

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.

6 participants