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

Fix clang warning when compiling with -ffast-math: use of infinity is undefined behavior due to the currently enabled floating-point options #1222

Merged
merged 1 commit into from
Dec 16, 2024

Conversation

pps83
Copy link
Contributor

@pps83 pps83 commented Nov 28, 2024

Fixes the following warning:

C:\boost_1_86_0\boost/math/ccmath/isinf.hpp(29,69): warning : use of infinity is undefined behavior due to the currently enabled floating-point options [-Wnan-infinity-disabled]
C:\boost_1_86_0\boost/math/ccmath/isinf.hpp(29,25): warning : use of infinity is undefined behavior due to the currently enabled floating-point options [-Wnan-infinity-disabled]
C:\boost_1_86_0\boost/math/ccmath/ldexp.hpp(50,38): note: in instantiation of function template specialization 'boost::math::ccmath::isinf<float>' requested here
C:\boost_1_86_0\boost/math/ccmath/ldexp.hpp(69,33): note: in instantiation of function template specialization 'boost::math::ccmath::ldexp<float, true>' requested here

… undefined behavior due to the currently enabled floating-point options

Fixes the following warning:
```
C:\boost_1_86_0\boost/math/ccmath/isinf.hpp(29,69): warning : use of infinity is undefined behavior due to the currently enabled floating-point options [-Wnan-infinity-disabled]
C:\boost_1_86_0\boost/math/ccmath/isinf.hpp(29,25): warning : use of infinity is undefined behavior due to the currently enabled floating-point options [-Wnan-infinity-disabled]
C:\boost_1_86_0\boost/math/ccmath/ldexp.hpp(50,38): note: in instantiation of function template specialization 'boost::math::ccmath::isinf<float>' requested here
C:\boost_1_86_0\boost/math/ccmath/ldexp.hpp(69,33): note: in instantiation of function template specialization 'boost::math::ccmath::ldexp<float, true>' requested here
```
@pps83
Copy link
Contributor Author

pps83 commented Nov 28, 2024

the question is: should this be suppressed or not? with -fast-math I get tons of warnings from this code.

Copy link

codecov bot commented Nov 28, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 93.83%. Comparing base (8f843fd) to head (289e181).
Report is 6 commits behind head on develop.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff            @@
##           develop    #1222   +/-   ##
========================================
  Coverage    93.83%   93.83%           
========================================
  Files          657      657           
  Lines        55241    55241           
========================================
  Hits         51836    51836           
  Misses        3405     3405           

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8f843fd...289e181. Read the comment docs.

@jzmaddock
Copy link
Collaborator

the question is: should this be suppressed or not? with -fast-math I get tons of warnings from this code.

As long as -ffast-math doesn't break the code, then yes it should be suppressed I would say.

@pps83
Copy link
Contributor Author

pps83 commented Dec 13, 2024

@mborland can you please check the PR?

@mborland mborland merged commit 699d79b into boostorg:develop Dec 16, 2024
74 of 80 checks passed
@ckormanyos
Copy link
Member

ckormanyos commented Dec 17, 2024

Hi folks, this thing just broke my CI in an unrelated project, in which I have -Werror activated. I think or maybe it seems like It seems that some __clang_major versions are caught by the test on greater than 6.

See also this broken CI.

I haven't quite figured out the exact way to weed through all the compilers yet, but I think a higher version check might be needed. But I also got red on version 15.

Oh and if you tell me I should just activate -ffast-math I'm fine with that. i don't know if I have it or not on those runs.

Cc: @jzmaddock and @mborland

@mborland
Copy link
Member

I'll fix it. The flag was added in Clang-18 so it's relatively new

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