From: Adhemerval Zanella Date: Fri, 17 Oct 2025 19:13:18 +0000 (-0300) Subject: Build glibc with -ftrapping-math X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=111f2367f4847287497ba786557d71340eb452eb;p=thirdparty%2Fglibc.git Build glibc with -ftrapping-math GCC enables it by default, clang in the other hand sets -fno-trapping-math. This is required to fix some math and stdlib tests that explicit raises floating point exceptions: math/test-double-canonicalize.out testing double (without inline functions) Failure: canonicalize (max_value): Exception "Overflow" set Failure: canonicalize (max_value): Exception "Inexact" set Failure: canonicalize (-max_value): Exception "Overflow" set Failure: canonicalize (-max_value): Exception "Inexact" set Failure: canonicalize_downward (max_value): Exception "Overflow" set Failure: canonicalize_downward (max_value): Exception "Inexact" set Failure: canonicalize_downward (-max_value): Exception "Overflow" set Failure: canonicalize_downward (-max_value): Exception "Inexact" set Failure: canonicalize_towardzero (max_value): Exception "Overflow" set Failure: canonicalize_towardzero (max_value): Exception "Inexact" set Failure: canonicalize_towardzero (-max_value): Exception "Overflow" set Failure: canonicalize_towardzero (-max_value): Exception "Inexact" set Failure: canonicalize_upward (max_value): Exception "Overflow" set Failure: canonicalize_upward (max_value): Exception "Inexact" set Failure: canonicalize_upward (-max_value): Exception "Overflow" set Failure: canonicalize_upward (-max_value): Exception "Inexact" set test-float-catanh.out testing float (without inline functions) Failure: Real part of: catanh (-0x1.000002p+0 - 0x4p-128 i): Exception "Underflow" set Failure: Real part of: catanh (-0x1.000002p+0 - 0x8p-152 i): Exception "Underflow" set Failure: Real part of: catanh (-0x1.000002p+0 + 0x4p-128 i): Exception "Underflow" set Failure: Real part of: catanh (-0x1.000002p+0 + 0x8p-152 i): Exception "Underflow" set Failure: Real part of: catanh (-0xf.fffffp-4 - 0x4p-128 i): Exception "Underflow" set Failure: Real part of: catanh (-0xf.fffffp-4 + 0x4p-128 i): Exception "Underflow" set Failure: Real part of: catanh (0x1.000002p+0 - 0x4p-128 i): Exception "Underflow" set Failure: Real part of: catanh (0x1.000002p+0 - 0x8p-152 i): Exception "Underflow" set Failure: Real part of: catanh (0x1.000002p+0 + 0x4p-128 i): Exception "Underflow" set Failure: Real part of: catanh (0x1.000002p+0 + 0x8p-152 i): Exception "Underflow" set Failure: Real part of: catanh (0xf.fffffp-4 - 0x4p-128 i): Exception "Underflow" set Failure: Real part of: catanh (0xf.fffffp-4 + 0x4p-128 i): Exception "Underflow" set Failure: Real part of: catanh_downward (-0x1.000002p+0 - 0x4p-128 i): Exception "Underflow" set Failure: Real part of: catanh_downward (-0x1.000002p+0 - 0x8p-152 i): Exception "Underflow" set Failure: Real part of: catanh_downward (-0x1.000002p+0 + 0x4p-128 i): Exception "Underflow" set Failure: Real part of: catanh_downward (-0x1.000002p+0 + 0x8p-152 i): Exception "Underflow" set Failure: Real part of: catanh_downward (-0xf.fffffp-4 - 0x4p-128 i): Exception "Underflow" set Failure: Real part of: catanh_downward (-0xf.fffffp-4 + 0x4p-128 i): Exception "Underflow" set Failure: Real part of: catanh_downward (0x1.000002p+0 - 0x4p-128 i): Exception "Underflow" set Failure: Real part of: catanh_downward (0x1.000002p+0 - 0x8p-152 i): Exception "Underflow" set Failure: Real part of: catanh_downward (0x1.000002p+0 + 0x4p-128 i): Exception "Underflow" set Failure: Real part of: catanh_downward (0x1.000002p+0 + 0x8p-152 i): Exception "Underflow" set Failure: Real part of: catanh_downward (0xf.fffffp-4 - 0x4p-128 i): Exception "Underflow" set Failure: Real part of: catanh_downward (0xf.fffffp-4 + 0x4p-128 i): Exception "Underflow" set Failure: Real part of: catanh_towardzero (-0x1.000002p+0 - 0x4p-128 i): Exception "Underflow" set Failure: Real part of: catanh_towardzero (-0x1.000002p+0 - 0x8p-152 i): Exception "Underflow" set Failure: Real part of: catanh_towardzero (-0x1.000002p+0 + 0x4p-128 i): Exception "Underflow" set Failure: Real part of: catanh_towardzero (-0x1.000002p+0 + 0x8p-152 i): Exception "Underflow" set Failure: Real part of: catanh_towardzero (-0xf.fffffp-4 - 0x4p-128 i): Exception "Underflow" set Failure: Real part of: catanh_towardzero (-0xf.fffffp-4 + 0x4p-128 i): Exception "Underflow" set Failure: Real part of: catanh_towardzero (0x1.000002p+0 - 0x4p-128 i): Exception "Underflow" set Failure: Real part of: catanh_towardzero (0x1.000002p+0 - 0x8p-152 i): Exception "Underflow" set Failure: Real part of: catanh_towardzero (0x1.000002p+0 + 0x4p-128 i): Exception "Underflow" set Failure: Real part of: catanh_towardzero (0x1.000002p+0 + 0x8p-152 i): Exception "Underflow" set Failure: Real part of: catanh_towardzero (0xf.fffffp-4 - 0x4p-128 i): Exception "Underflow" set Failure: Real part of: catanh_towardzero (0xf.fffffp-4 + 0x4p-128 i): Exception "Underflow" set Failure: Real part of: catanh_upward (-0x1.000002p+0 - 0x4p-128 i): Exception "Underflow" set Failure: Real part of: catanh_upward (-0x1.000002p+0 - 0x8p-152 i): Exception "Underflow" set Failure: Real part of: catanh_upward (-0x1.000002p+0 + 0x4p-128 i): Exception "Underflow" set Failure: Real part of: catanh_upward (-0x1.000002p+0 + 0x8p-152 i): Exception "Underflow" set Failure: Real part of: catanh_upward (-0xf.fffffp-4 - 0x4p-128 i): Exception "Underflow" set Failure: Real part of: catanh_upward (-0xf.fffffp-4 + 0x4p-128 i): Exception "Underflow" set Failure: Real part of: catanh_upward (0x1.000002p+0 - 0x4p-128 i): Exception "Underflow" set Failure: Real part of: catanh_upward (0x1.000002p+0 - 0x8p-152 i): Exception "Underflow" set Failure: Real part of: catanh_upward (0x1.000002p+0 + 0x4p-128 i): Exception "Underflow" set Failure: Real part of: catanh_upward (0x1.000002p+0 + 0x8p-152 i): Exception "Underflow" set Failure: Real part of: catanh_upward (0xf.fffffp-4 - 0x4p-128 i): Exception "Underflow" set Failure: Real part of: catanh_upward (0xf.fffffp-4 + 0x4p-128 i): Exception "Underflow" set Reviewed-by: H.J. Lu --- diff --git a/Makeconfig b/Makeconfig index 9eda4fa528..eb44bbd113 100644 --- a/Makeconfig +++ b/Makeconfig @@ -916,6 +916,9 @@ endif # disable any optimization that assume default rounding mode. +math-flags = -frounding-math +# We have to assume that glibc functions might generate user-visible traps. ++math-flags += -ftrapping-math + # Logically only "libnldbl", "nonlib" and "testsuite" should be using # -fno-math-errno. However due to GCC bug #88576, only "libm" and # "libmvec" can use -fno-math-errno.