Somewhere in the past month, lib/msun/fmaxmin_test:main started failing in testcase 6, 7, 11, and 12. I've seen this issue on my workstation at work, on Jenkins [1], and my amd64 VM (output attached below). It seems that "rounding mode 0" is the problem symptom. 1. https://jenkins.freebsd.org/job/FreeBSD_HEAD/183/testReport/lib.msun/fmaxmin_test/main/ $ uname -a FreeBSD fbsd11 11.0-CURRENT FreeBSD 11.0-CURRENT #1 r296025+f1d280e(isilon-atf): Wed Apr 6 17:28:12 PDT 2016 ngie@fbsd11:/usr/obj/usr/src/git/sys/GENERIC-NODEBUG amd64 $ kyua debug -k /usr/tests/lib/msun/Kyuafile fmaxmin_test:main fmaxf(1, nan) raised 0x1 fmaxf(nan, 1) raised 0x1 fmax(1, nan) raised 0x1 fmax(nan, 1) raised 0x1 fminf(1, nan) raised 0x1 fminf(nan, 1) raised 0x1 fmin(1, nan) raised 0x1 fmin(nan, 1) raised 0x1 FAILURE in rounding mode 0 fmaxf(inf, nan) raised 0x1 fmaxf(nan, inf) raised 0x1 fmax(inf, nan) raised 0x1 fmax(nan, inf) raised 0x1 fminf(inf, nan) raised 0x1 fminf(nan, inf) raised 0x1 fmin(inf, nan) raised 0x1 fmin(nan, inf) raised 0x1 FAILURE in rounding mode 0 fmaxf(nan, nan) raised 0x1 fmaxf(nan, nan) raised 0x1 fmax(nan, nan) raised 0x1 fmax(nan, nan) raised 0x1 fminf(nan, nan) raised 0x1 fminf(nan, nan) raised 0x1 fmin(nan, nan) raised 0x1 fmin(nan, nan) raised 0x1 FAILURE in rounding mode 0 fmaxf(-0, 0) = -0, expected 0 fmax(-0, 0) = -0, expected 0 fminf(0, -0) = 0, expected -0 fmin(0, -0) = 0, expected -0 FAILURE in rounding mode 0 1..12 ok 1 - big = 1, small = 0 ok 2 - big = 42, small = 41.999996185302734375 ok 3 - big = 42.000003814697265625, small = 42 ok 4 - big = -5, small = -5 ok 5 - big = -3, small = -4 not ok 6 - big = 1, small = nan not ok 7 - big = inf, small = nan ok 8 - big = inf, small = 1 ok 9 - big = -3, small = -inf ok 10 - big = 3, small = -inf not ok 11 - big = nan, small = nan not ok 12 - big = 0, small = -0 fmaxmin_test:main -> failed: 4 tests of 12 failed
clang 3.8 seems to be the problem. The test passes using either clang37 from ports or gcc 4.2.1 from base. Reassigning to dim@.
How does one run these particular tests? I've tried "make tests", but those all appear to succeed, both on i386 and amd64.
Note also that similar to the discussion started by Steve Kargl on freebsd-toolchain, "#pragma STDC FENV_ACCESS ON" is not supported by gcc or clang, and therefore testing and setting of floating point exception registers through fesetexcept(), fegetexcept() and so on have undefined behavior. See also the discussion on LLVM PR 26931 [1] which I submitted after Steve's mails. Eventually it boiled down to: > You can't use these fe* functions outside of a region marked with #pragma STDC FENV_ACCESS ON. > > See C11 7.6.1/2: "If part of a program tests floating-point status flags, > sets floating-point control modes, or runs under non-default mode settings, > but was translated with the state for the FENV_ACCESS pragma ‘‘off’’, the > behavior is undefined." That said, the tests work for me, probably because they're all compiled with -O0. Maybe that in combination with a few strategic volatile qualifiers will fix the test cases. Alternatively, we can just disable them for COMPILER_VERSION >= 38. [1] https://llvm.org/bugs/show_bug.cgi?id=26931
A commit references this bug: Author: ngie Date: Thu Apr 14 04:40:31 UTC 2016 New revision: 297952 URL: https://svnweb.freebsd.org/changeset/base/297952 Log: Disable fmaxmin_test when compiling it with clang 3.8.0 The testcase always fails today due to how C11 7.6.1/2 is interpreted with clang 3.8.0 when combined with "#pragma STDC FENV_ACCESS ON". This testcase passes with clang <3.8.0 and gcc, so continue testing it with those compiler combinations More intelligent discussion on the issue is in the PR MFC after: never PR: 208703 Sponsored by: EMC / Isilon Storage Division Changes: head/lib/msun/tests/Makefile
(In reply to Dimitry Andric from comment #3) I disabled the testcase to give us proper time to implement a fix. FWIW, on stable/10, running tests is done like: > make test On head, it's: > make check Be sure to run `make install` first.
A commit references this bug: Author: ngie Date: Thu Apr 21 19:59:55 UTC 2016 New revision: 298434 URL: https://svnweb.freebsd.org/changeset/base/298434 Log: Completely disable fmaxmin_test (follow up to r297952) COMPILER_TYPE/COMPILER_VERSION doesn't get passed down properly at buildworld/installworld with older build hosts MFC after: never PR: 208703, 208963 Reported by: Jenkins Sponsored by: EMC / Isilon Storage Division Changes: head/lib/msun/tests/Makefile
A commit references this bug: Author: bdrewery Date: Mon Aug 8 17:59:59 UTC 2016 New revision: 303841 URL: https://svnweb.freebsd.org/changeset/base/303841 Log: Revert r298434 which should be fixed by r301287, r301394, and r301403. PR: 208703, 208963 Changes: head/lib/msun/tests/Makefile
A commit references this bug: Author: ngie Date: Fri Jan 13 04:21:09 UTC 2017 New revision: 312012 URL: https://svnweb.freebsd.org/changeset/base/312012 Log: fmaxmin_test still fails with clang 3.9.x.. bypass the test MFC after: 3 days PR: 208703 Sponsored by: Dell EMC Isilon Changes: head/lib/msun/tests/Makefile
A commit references this bug: Author: ngie Date: Sun Jan 15 09:05:27 UTC 2017 New revision: 312213 URL: https://svnweb.freebsd.org/changeset/base/312213 Log: Turn COMPILER_VERSION/COMPILER_TYPE make check into a compile-time check of the clang version This works around breakage on ^/stable/10 when running installworld from a ^/stable/10 host where the test wouldn't be compiled on the first go-around and would be missing when make installworld is run. MFC after: 1 week PR: 208703 Reported by: emaste Sponsored by: Dell EMC Isilon Changes: head/lib/msun/tests/Makefile head/lib/msun/tests/fmaxmin_test.c
A commit references this bug: Author: ngie Date: Sat Feb 4 17:06:52 UTC 2017 New revision: 313237 URL: https://svnweb.freebsd.org/changeset/base/313237 Log: MFC r303841,r312012,r312213: r303841 (by bdrewery): Revert r298434 which should be fixed by r301287, r301394, and r301403. PR: 208703, 208963 r312012: fmaxmin_test still fails with clang 3.9.x.. bypass the test PR: 208703 r312213: Turn COMPILER_VERSION/COMPILER_TYPE make check into a compile-time check of the clang version This works around breakage on ^/stable/10 when running installworld from a ^/stable/10 host where the test wouldn't be compiled on the first go-around and would be missing when make installworld is run. PR: 208703 Changes: _U stable/11/ stable/11/lib/msun/tests/Makefile stable/11/lib/msun/tests/fmaxmin_test.c
A commit references this bug: Author: ngie Date: Tue Feb 14 00:54:48 UTC 2017 New revision: 313713 URL: https://svnweb.freebsd.org/changeset/base/313713 Log: Handle clang 4.x+ with the compile-time exception added in r312213 It also fails the assertions noted in bug 208703 PR: 208703 PR: 217084 Submitted by: jbeich MFC after: 1 week Sponsored by: Dell EMC Isilon Changes: head/lib/msun/tests/fmaxmin_test.c
A commit references this bug: Author: ngie Date: Tue Feb 21 03:49:53 UTC 2017 New revision: 314022 URL: https://svnweb.freebsd.org/changeset/base/314022 Log: MFC r313713: Handle clang 4.x+ with the compile-time exception added in r312213 It also fails the assertions noted in bug 208703 PR: 208703 PR: 217084 Changes: _U stable/11/ stable/11/lib/msun/tests/fmaxmin_test.c
A commit references this bug: Author: ngie Date: Tue Feb 21 03:50:57 UTC 2017 New revision: 314023 URL: https://svnweb.freebsd.org/changeset/base/314023 Log: MFC r312213,r313713: r312213: Turn COMPILER_VERSION/COMPILER_TYPE make check into a compile-time check of the clang version This works around breakage on ^/stable/10 when running installworld from a ^/stable/10 host where the test wouldn't be compiled on the first go-around and would be missing when make installworld is run. PR: 208703 r313713: Handle clang 4.x+ with the compile-time exception added in r312213 It also fails the assertions noted in bug 208703 PR: 208703 PR: 217084 Changes: _U stable/10/ stable/10/lib/msun/tests/fmaxmin_test.c
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=b358534ab1a953fac5830012751232e2f0807cc0 commit b358534ab1a953fac5830012751232e2f0807cc0 Author: Alex Richardson <arichardson@FreeBSD.org> AuthorDate: 2021-03-22 11:40:17 +0000 Commit: Alex Richardson <arichardson@FreeBSD.org> CommitDate: 2021-03-22 11:55:06 +0000 Remove XFAILs from fmaxmin test These appears to have been resolved by compiling the test with -fno-builtin and/or using a newer compiler. PR: 208703 Reviewed By: ngie Differential Revision: https://reviews.freebsd.org/D28884 lib/msun/tests/fmaxmin_test.c | 19 ------------------- 1 file changed, 19 deletions(-)
A commit in branch stable/13 references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=5ba5ebf92b5daec3f3eacf64fc56a863d9547bc3 commit 5ba5ebf92b5daec3f3eacf64fc56a863d9547bc3 Author: Alex Richardson <arichardson@FreeBSD.org> AuthorDate: 2021-03-22 11:40:17 +0000 Commit: Alex Richardson <arichardson@FreeBSD.org> CommitDate: 2021-04-22 09:43:13 +0000 Remove XFAILs from fmaxmin test These appears to have been resolved by compiling the test with -fno-builtin and/or using a newer compiler. PR: 208703 Reviewed By: ngie Differential Revision: https://reviews.freebsd.org/D28884 (cherry picked from commit b358534ab1a953fac5830012751232e2f0807cc0) lib/msun/tests/fmaxmin_test.c | 19 ------------------- 1 file changed, 19 deletions(-)