Skip to content

Avoid narrowing conversion in optional #4067

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

thomasspriggs
Copy link
Contributor

@thomasspriggs thomasspriggs commented Feb 4, 2019

This issue was causing compile warnings on Ubuntu 18, when compiling
with conversion warnings enabled. The result of size_of was being
converted to unsigned which is a narrowing conversion on 64 bit
platforms. This commit fixes this issue by changing the type to
std::size_t, which is large enough to store the result of size_of
without a narrowing conversion.

  • Each commit message has a non-empty body, explaining why the change was made.
  • Methods or procedures I have added are documented, following the guidelines provided in CODING_STANDARD.md.
  • 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).
  • 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.

This issue was causing compile warnings on Ubuntu 18, when compiling
with conversion warnings enabled. The result of `size_of` was being
converted to `unsigned` which is a narrowing conversion on 64 bit
platforms. This commit fixes this issue by changing the type to
`std::size_t`, which is large enough to store the resultof `size_of`
without a narrowing conversion.
Copy link
Contributor

@LAJW LAJW left a comment

Choose a reason for hiding this comment

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

Sick

@tautschnig
Copy link
Collaborator

It seems this has been fixed upstream already - should we actually just import the latest version?

@thomasspriggs
Copy link
Contributor Author

@tautschnig The license on this library seems to have been changed from MIT to Boost in the latest version. There also appears to be a substantial number of other changes made. I would like to get this PR merged in order to fix compile problems I have locally. I would prefer to avoid spending time investigating other licensing and other potential compatibility issues right now.

@thomasspriggs thomasspriggs requested a review from thk123 February 4, 2019 12:17
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: 0790c01).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/99619894

@tautschnig tautschnig merged commit 5530ca3 into diffblue:develop Feb 4, 2019
@thomasspriggs thomasspriggs deleted the tas/fix_ubuntu18_optional branch February 4, 2019 13:48
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.

6 participants