Not sure if this UB causes issues with any compiler. clang is fine, see:
-fsanitize=float-divide-by-zero
: Floating point division by zero. This is undefined per the C and C++ standards, but is defined by Clang (and by ISO/IEC/IEEE 60559 / IEEE 754) as producing either an infinity or NaN value, so is not included in-fsanitize=undefined
.
To reproduce just compile --with-sanitizers=float-divide-by-zero
and run something, for example bitcoind
:
0UBSAN_OPTIONS="suppressions=$(pwd)/test/sanitizer_suppressions/ubsan:print_stacktrace=1:halt_on_error=1:report_error_type=1" ./src/bitcoind -datadir=/tmp -signet -debug=bench -noprinttoconsole
1validation.cpp:2839:5: runtime error: division by zero
float-divide-by-zero
is enabled by OSS-Fuzz, see https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=58887
I haven’t checked, but I presume this instance was introduced by https://github.com/bitcoin/bitcoin/pull/24216