[Bug 51895] New: ucrtbase:misc fma(inf, 0, 0) 'succeeds' unexpectedly on some machines

WineHQ Bugzilla wine-bugs at winehq.org
Mon Oct 18 11:30:54 CDT 2021


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 at winehq.org
          Reporter: fgouget at 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-fmal

So maybe applications cannot rely on errno being set (particularly on modern
processors) and this particular test should be removed.

-- 
Do not reply to this email, post in Bugzilla using the
above URL to reply.
You are receiving this mail because:
You are watching all bug changes.



More information about the wine-bugs mailing list