Re:Optimizations Enabled by -ffast-Math
by jcelerier on Wednesday October 20, 2021 @04:26AM
(#28928166)
At least GCC is I believe fairly buggy in that regard since isnan is optimised out, thus you cannot check if say an incoming value read from the network is a NaN. There's some lengthy discussion about it on the big tracker iirc..
[ Parent
| on HN ]
Re:Optimizations Enabled by -ffast-Math
by jcelerier on Wednesday October 20, 2021 @07:07AM
(#28929271)
I was misremembering, was thinking about this recent convo on LLVM mailinglist: https://lists.llvm.org/pipermail/llvm-dev/2021-September/152...
Re:Optimizations Enabled by -ffast-Math
by usefulcat on Wednesday October 20, 2021 @12:39PM
(#28932807)
I don't think you are misremembering; -ffast-math causes __builtin_isnan and __builtin_isinf to unconditionally return zero, for both gcc and clang:
https://godbolt.org/z/1qjxvW3KK
I found this out the hard way several years ago and still have my own implementations of these functions laying about in case I want to use -ffast-math.