Piotr Caban : msvcrt: Fix x87 FPU status register assignment detection.

Alexandre Julliard julliard at winehq.org
Mon Aug 9 16:21:42 CDT 2021


Module: wine
Branch: master
Commit: 62d2693701c1756264fdf975578cb7f6abd5c1b1
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=62d2693701c1756264fdf975578cb7f6abd5c1b1

Author: Piotr Caban <piotr at codeweavers.com>
Date:   Mon Aug  9 00:28:08 2021 +0200

msvcrt: Fix x87 FPU status register assignment detection.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=51568
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=51579
Signed-off-by: Piotr Caban <piotr at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/msvcrt/math.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/dlls/msvcrt/math.c b/dlls/msvcrt/math.c
index bb450fad01c..efdde8e4afb 100644
--- a/dlls/msvcrt/math.c
+++ b/dlls/msvcrt/math.c
@@ -35,6 +35,7 @@
  * ====================================================
  */
 
+#include <assert.h>
 #include <complex.h>
 #include <stdio.h>
 #include <fenv.h>
@@ -5321,7 +5322,7 @@ static BOOL _setfp( unsigned int *cw, unsigned int cw_mask,
         if (*cw & _IC_AFFINE) newcw |= 0x1000;
     }
 
-    if (oldsw != newsw && newsw)
+    if (oldsw != newsw && (newsw & 0x3f))
     {
         struct {
             WORD control_word;
@@ -5338,6 +5339,8 @@ static BOOL _setfp( unsigned int *cw, unsigned int cw_mask,
             WORD unused5;
         } fenv;
 
+        assert(cw);
+
         __asm__ __volatile__( "fnstenv %0" : "=m" (fenv) );
         fenv.control_word = newcw;
         fenv.status_word = newsw;




More information about the wine-cvs mailing list