Fixes gdiplus tests in Clang build.
When the compiler assumes non-trapping floating-point math, it may apply more aggressive optimizations. For example, in the fast path of `GdipInvertMatrix`, it may merge paired divisions into a single `divss` instruction. This can leave unused lanes whose results are ignored, but they still execute and may cause a division by zero, breaking tests that have the FP exception mask enabled.
Using `-ffp-exception-behavior=maytrap` prevents the compiler from performing such transformations.
It's a bit surprising that this flag also disables optimizations like those seen in the dmime tests, so there’s likely room for improvement on the compiler side. Regardless, relying on `round()` in tests isn't valid, as it's not available in msvcrt.dll and may depend on compiler-specific behavior.
-- v2: configure: Build PEs with -ffp-exception-behavior=maytrap. dmime/tests: Use ceil instead of round.
From: Jacek Caban jacek@codeweavers.com
round is not available in msvcrt.dll. While it’s typically handled via a compiler builtin, that’s not the case with Clang when -ffp-exception-behavior=maytrap is used. --- dlls/dmime/tests/dmime.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dlls/dmime/tests/dmime.c b/dlls/dmime/tests/dmime.c index 2329a1411ba..389f2546c01 100644 --- a/dlls/dmime/tests/dmime.c +++ b/dlls/dmime/tests/dmime.c @@ -4090,7 +4090,7 @@ static void test_wave_pmsg(unsigned num_repeats) hr = IDirectMusicPerformance_ReferenceToMusicTime(performance, 1000000, &length); ok(hr == S_OK, "got %#lx\n", hr); /* assuming not modified tempo */ - length = round((1000000 * 120.0 * DMUS_PPQ) / 600000000.0); + length = ceil((1000000 * 120.0 * DMUS_PPQ) / 600000000.0);
for (i = 0; i <= num_repeats; i++) {
From: Jacek Caban jacek@codeweavers.com
Fixes gdiplus tests in Clang build. --- configure.ac | 1 + 1 file changed, 1 insertion(+)
diff --git a/configure.ac b/configure.ac index c408e3788d6..ff306d6a98e 100644 --- a/configure.ac +++ b/configure.ac @@ -565,6 +565,7 @@ This is an error since --enable-archs=$wine_arch was requested.])]) WINE_TRY_PE_CFLAGS([-Wenum-enum-conversion],[:],WINE_TRY_PE_CFLAGS([-Wenum-conversion])) WINE_TRY_PE_CFLAGS([-ffunction-sections]) WINE_TRY_PE_CFLAGS([-fasync-exceptions -DMIN_CLANG_VERSION=19], AS_VAR_APPEND([${wine_arch}_EXTRACFLAGS],[" -fasync-exceptions"])) + WINE_TRY_PE_CFLAGS([-ffp-exception-behavior=maytrap])
dnl clang had broken -fms-hotpatch support before version 18 (https://github.com/llvm/llvm-project/pull/77245) WINE_TRY_PE_CFLAGS([-fms-hotpatch -DMIN_CLANG_VERSION=18],
v2: Reordered commits.