boostorg / boostorg/interval

Ill-formed narrowing conversions for ppc

Open
#29 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
31
Forks
48
PR merge metrics
No merged PRs in 30d

Description

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

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.