--
Best regards,
LIU Hao

From 8959c30982e0802fc3d12c9e1688145ac5708cf0 Mon Sep 17 00:00:00 2001
From: LIU Hao <lh_mo...@126.com>
Date: Fri, 14 Feb 2025 10:57:36 +0800
Subject: [PATCH] crt/fesetexceptflag: Fix MXCSR operation

It should set the exception bits, rather than the exception mask bits.
Code on line 38-41 does the correct operation to the x87 status bits.

Signed-off-by: LIU Hao <lh_mo...@126.com>
---
 mingw-w64-crt/misc/fesetexceptflag.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/mingw-w64-crt/misc/fesetexceptflag.c 
b/mingw-w64-crt/misc/fesetexceptflag.c
index 095dfea0b..3e6012c76 100644
--- a/mingw-w64-crt/misc/fesetexceptflag.c
+++ b/mingw-w64-crt/misc/fesetexceptflag.c
@@ -44,8 +44,8 @@ int fesetexceptflag (const fexcept_t * flagp, int excepts)
     {
       int sse_cw;
       __asm__ volatile ("stmxcsr %0;" : "=m" (sse_cw));
-      sse_cw &= ~(excepts << 7);
-      sse_cw |= ((*flagp & excepts) << 7);
+      sse_cw &= ~excepts;
+      sse_cw |= (*flagp & excepts);
       __asm__ volatile ("ldmxcsr %0" : : "m" (sse_cw));
     }
 
-- 
2.48.1

Attachment: OpenPGP_signature.asc
Description: OpenPGP digital signature

_______________________________________________
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to