On Sat, Oct 14, 2023 at 01:49:34PM +0100, Richard W.M. Jones wrote:
FAIL: test-public
=================
Wrong return value for inf, got 0, expected -1
Wrong result for inf, got inf, expected 0
Wrong return value for nan, got 0, expected -1
Wrong return value for nan/inf, got 0, expected -1
Wrong return value for inf/inf, got 0, expected -1
Wrong return value for nan/nan, got 0, expected -1
Wrong return value for -0, got 0, expected -1
Wrong return value for 1e200/1e-200, got 0, expected -1
Wrong result for 1e200/1e-200, got inf, expected 0
FAIL test-public (exit status: 1)
This turned out to be caused by using -Ofast or -ffast-math, and more
specifically the -ffinite-math-only option. This option allows the
compiler to assume that all floating point operations have finite,
non-NaN parameters, thus functions like isfinite(3) in the standard
library are simply expected not to work.
As I said on the bug report the workaround is to use
-fno-finite-math-only, but better would be not to use the options
-Ofast/-ffast-math in the first place.
I don't think this is something we need to fix upstream, since by
using those options you're breaking the compiler, so in my view as the
user you get to keep the pieces.
Also there's not a reliable way to even detect this. Using
-ffast-math defines "__FAST_MATH__", but apparently nothing is defined
for the specific option -ffinite-math-only.
Rich.
--
Richard Jones, Virtualization Group, Red Hat
http://people.redhat.com/~rjones
Read my programming and virtualization blog:
http://rwmj.wordpress.com
virt-top is 'top' for virtual machines. Tiny program with many
powerful monitoring features, net stats, disk stats, logging, etc.
http://people.redhat.com/~rjones/virt-top