Building glibc 2.36 on Ubuntu 22.10 using gcc 12 fails like so: FAIL: math/test-float128-y1 original exit status 1 testing _Float128 (without inline functions) Failure: Test: y1_downward (0x1.c1badep+0) Result: is: -2.49850711930108135145795303826944004e-01 -0x1.ffb1bae4fa20118544b142160f5fp-3 should be: -2.49850711930108135145795303826943836e-01 -0x1.ffb1bae4fa20118544b142160f58p-3 difference: 1.68518870133883137142398069976181140e-34 0x1.c000000000000000000000000000p-113 ulp : 7.0000 max.ulp : 5.0000 Maximal error of `y1_downward' is : 7 ulp accepted: 5 ulp Test suite completed: 216 test cases plus 212 tests for exception flags and 212 tests for errno executed. 2 errors occurred. I'm reasonably confident but not yet certain that building with gcc 11 works. I see that fedora 37 built glibc 2.36 with gcc 12 without hitting this issue, so it's possible it's the result of some Ubuntu-specific gcc issue but I'm not really sure.
Turns out compiling just math/e_j1f128.os with gcc 11 is enough to make this failure go away. So probably a gcc issue indeed.
Compiling just math/e_j1f128.os with gcc 12 and -O2 rather than -O3 also fixes this.
I filed https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106574 although at this point it's not clear where the issue is.
This is fixed on master now with https://sourceware.org/git/?p=glibc.git;a=commit;h=2b274fd8c9c776cf70fcdb8356e678ada522a7b0 but apparently I didn't trigger the bot. commit 2b274fd8c9c776cf70fcdb8356e678ada522a7b0 Author: Michael Hudson-Doyle <michael.hudson@canonical.com> Date: Fri Aug 12 11:29:31 2022 +1200 Ensure calculations happen with desired rounding mode in y1lf128 math/test-float128-y1 fails on x86_64 and ppc64el with gcc 12 and -O3, because code inside a block guarded by SET_RESTORE_ROUNDL is being moved after the rounding mode has been restored. Use math_force_eval to prevent this (and insert some math_opt_barrier calls to prevent code from being moved before the rounding mode is set). Fixes #29463 Reviewed-By: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
The master branch has been updated by Tulio Magno Quites Machado Filho <tuliom@sourceware.org>: https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=b6e37b7805b0182c3e25cdab39ebf5f001c04d05 commit b6e37b7805b0182c3e25cdab39ebf5f001c04d05 Author: Michael Hudson-Doyle <michael.hudson@canonical.com> Date: Mon Aug 22 14:05:04 2022 +1200 Fix BZ #29463 in the ibm128 implementation of y1l too Avoid moving code across SET_RESTORE_ROUNDL in order to fix [BZ #29463]. Tested-by: Aurelien Jarno <aurelien@aurel32.net> Reviewed-by: Aurelien Jarno <aurelien@aurel32.net> Reviewed-by: Tulio Magno Quites Machado Filho <tuliom@linux.ibm.com>
The release/2.36/master branch has been updated by Aurelien Jarno <aurel32@sourceware.org>: https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=b357157361117182c7a68c90fda7ba431b64442c commit b357157361117182c7a68c90fda7ba431b64442c Author: Michael Hudson-Doyle <michael.hudson@canonical.com> Date: Mon Aug 22 14:05:04 2022 +1200 Fix BZ #29463 in the ibm128 implementation of y1l too Avoid moving code across SET_RESTORE_ROUNDL in order to fix [BZ #29463]. Tested-by: Aurelien Jarno <aurelien@aurel32.net> Reviewed-by: Aurelien Jarno <aurelien@aurel32.net> Reviewed-by: Tulio Magno Quites Machado Filho <tuliom@linux.ibm.com> (cherry picked from commit b6e37b7805b0182c3e25cdab39ebf5f001c04d05)