Skip to content
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

Ill-formed narrowing conversions for ppc #29

Open
jwakely opened this issue Jan 31, 2022 · 0 comments · May be fixed by #30
Open

Ill-formed narrowing conversions for ppc #29

jwakely opened this issue Jan 31, 2022 · 0 comments · May be fixed by #30

Comments

@jwakely
Copy link

jwakely commented Jan 31, 2022

/usr/include/boost/numeric/interval/detail/ppc_rounding_control.hpp:31:56: error: narrowing conversion of '18444492273895866370' from 'long long unsigned int' to 'boost::long_long_type' {aka 'long long int'} [-Wnarrowing]
   31 | static const rounding_mode_struct mode_upward      = { 0xFFF8000000000002LL };
      |                                                        ^~~~~~~~~~~~~~~~~~~~
/usr/include/boost/numeric/interval/detail/ppc_rounding_control.hpp:32:56: error: narrowing conversion of '18444492273895866371' from 'long long unsigned int' to 'boost::long_long_type' {aka 'long long int'} [-Wnarrowing]
   32 | static const rounding_mode_struct mode_downward    = { 0xFFF8000000000003LL };
      |                                                        ^~~~~~~~~~~~~~~~~~~~
/usr/include/boost/numeric/interval/detail/ppc_rounding_control.hpp:33:56: error: narrowing conversion of '18444492273895866368' from 'long long unsigned int' to 'boost::long_long_type' {aka 'long long int'} [-Wnarrowing]
   33 | static const rounding_mode_struct mode_to_nearest  = { 0xFFF8000000000000LL };
      |                                                        ^~~~~~~~~~~~~~~~~~~~
/usr/include/boost/numeric/interval/detail/ppc_rounding_control.hpp:34:56: error: narrowing conversion of '18444492273895866369' from 'long long unsigned int' to 'boost::long_long_type' {aka 'long long int'} [-Wnarrowing]
   34 | static const rounding_mode_struct mode_toward_zero = { 0xFFF8000000000001LL };
      |                                                        ^~~~~~~~~~~~~~~~~~~~

These constants are too large for long long so they have type unsigned long long (despite the LL suffix). Converting them to long long inside a braced-init-list is a narrowing conversion.

jwakely added a commit to jwakely/interval that referenced this issue Jan 31, 2022
These constants are too large for `long long` so are unsigned,
and then cannot be narrowed to the signed type.

Fixes boostorg#29
@jwakely jwakely linked a pull request Jan 31, 2022 that will close this issue
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 a pull request may close this issue.

1 participant