https://bugs.winehq.org/show_bug.cgi?id=51895
Bug ID: 51895 Summary: ucrtbase:misc fma(inf, 0, 0) 'succeeds' unexpectedly on some machines Product: Wine Version: unspecified Hardware: x86-64 OS: Windows Status: NEW Severity: normal Priority: P2 Component: ucrtbase Assignee: wine-bugs@winehq.org Reporter: fgouget@codeweavers.com
ucrtbase:misc fma(inf, 0, 0) 'succeeds' unexpectedly on some machines:
misc.c:799: Test failed: fma(inf, 0.000000, 0.000000) got errno -1 misc.c:799: Test failed: fma(0.000000, inf, 0.000000) got errno -1 misc.c:799: Test failed: fma(inf, 1.000000, -inf) got errno -1 misc.c:799: Test failed: fma(-inf, 1.000000, inf) got errno -1 misc.c:799: Test failed: fma(1.000000, inf, -inf) got errno -1 misc.c:799: Test failed: fma(1.000000, -inf, inf) got errno -1
https://test.winehq.org/data/patterns.html#ucrtbase:misc
Additional tests seem to indicate this is related to the CPU features: * The test succeeds on all TestBot VMs, and they also all return _get_FMA3_enabled() = 0. * The test fails on fgtb-w10pro64 (i7-4790K) where _get_FMA3_enabled() returns 1. * Paul Gofman reported getting this failure on a modern AMD processor where _get_FMA3_enabled() presumably returns 1 too.
Yet: * The documentation says _get_FMA3_enabled() is about transcendental functions. fma() is not one of them. * _get_FMA3_enabled() is only available in 64-bit code but the failures happen on both 32- and 64-bit code.
So it does look like this is related to the fma() implementation (x87/SSE2/other?) picked by the ucrtbase library as opposed to library version issues. But the details are murky and there may be some other common factor.
The MSDN documentation does say that fma(inf,0,0) should return NaN, which it does. The documentation is less clear on errno which is what we test. https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/fma-fmaf-fm...
So maybe applications cannot rely on errno being set (particularly on modern processors) and this particular test should be removed.
https://bugs.winehq.org/show_bug.cgi?id=51895
--- Comment #1 from François Gouget fgouget@codeweavers.com --- Created attachment 70841 --> https://bugs.winehq.org/attachment.cgi?id=70841 Extra traces for the fma(inf,0,0) failure
Comment out, or not, the "makes no difference" lines to figure out what's going on.
https://bugs.winehq.org/show_bug.cgi?id=51895
François Gouget fgouget@codeweavers.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Keywords| |source, testcase
https://bugs.winehq.org/show_bug.cgi?id=51895
Piotr Caban piotr.caban@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Fixed by SHA1| |1939528dab19ad769a4a5c6a4cb | |b02dfa479f6cf Status|NEW |RESOLVED Resolution|--- |FIXED CC| |piotr.caban@gmail.com
--- Comment #2 from Piotr Caban piotr.caban@gmail.com --- It should be fixed by 1939528dab19ad769a4a5c6a4cbb02dfa479f6cf. Marking as fixed.
https://bugs.winehq.org/show_bug.cgi?id=51895
Alexandre Julliard julliard@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED
--- Comment #3 from Alexandre Julliard julliard@winehq.org --- Closing bugs fixed in 6.23.