On 2017/10/26 19:53, sisyph...@optusnet.com.au wrote:
-----Original Message----- From: JonY via Mingw-w64-public
Sent: Thursday, October 26, 2017 10:03 PM
To: mingw-w64-public@lists.sourceforge.net
Cc: JonY
Subject: [Mingw-w64-public] New bug fix from v5.x release soon

Are there any bug fix commits from master that you think should go into v5.x?
Let me know ASAP, thanks.

Is https://sourceforge.net/p/mingw-w64/bugs/478/ being fixed ?

It's a bug that has continued to cause me grief over the last couple of years - largely because the perl5 developers have chosen to *not* work around it.

Cheers,
Rob
The asm statements fail to clobber the AX register so the compiler thinks they were left alone and stores a pointer in {R,E}AX.

The attached patch should fix the problem. This is a quick fix and I don't have time to test it, please test so we can push this patch before this release.


--
Best regards,
LH_Mouse
From 6988618931548eea602319488e60d32557d704c2 Mon Sep 17 00:00:00 2001
From: Liu Hao <lh_mo...@126.com>
Date: Thu, 26 Oct 2017 20:48:45 +0800
Subject: [PATCH] mingw-w64-crt/math/modf{,f,l}.c: Fix segment faults in
 modf(), modff() and modfl().

Reference: https://sourceforge.net/p/mingw-w64/bugs/478/
Signed-off-by: Liu Hao <lh_mo...@126.com>
---
 mingw-w64-crt/math/modf.c  | 4 ++--
 mingw-w64-crt/math/modff.c | 4 ++--
 mingw-w64-crt/math/modfl.c | 4 ++--
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/mingw-w64-crt/math/modf.c b/mingw-w64-crt/math/modf.c
index 068aec6c..f8ba64e8 100644
--- a/mingw-w64-crt/math/modf.c
+++ b/mingw-w64-crt/math/modf.c
@@ -21,7 +21,7 @@ modf (double value, double* iptr)
     "fldcw (%%rsp)\n"
     "frndint\n"
     "fldcw 4(%%rsp)\n"
-    "addq $8, %%rsp\n" : "=t" (int_part) : "0" (value)); /* round */
+    "addq $8, %%rsp\n" : "=t" (int_part) : "0" (value) : "eax"); /* round */
 #elif defined(_X86_) || defined(__i386__)
   asm ("push %%eax\n\tsubl $8, %%esp\n"
     "fnstcw 4(%%esp)\n"
@@ -31,7 +31,7 @@ modf (double value, double* iptr)
     "fldcw (%%esp)\n"
     "frndint\n"
     "fldcw 4(%%esp)\n"
-    "addl $8, %%esp\n\tpop %%eax\n" : "=t" (int_part) : "0" (value)); /* round 
*/
+    "addl $8, %%esp\n\tpop %%eax\n" : "=t" (int_part) : "0" (value) : "eax"); 
/* round */
 #else
   int_part = trunc(value);
 #endif
diff --git a/mingw-w64-crt/math/modff.c b/mingw-w64-crt/math/modff.c
index 3e08f9dd..2c4de3eb 100644
--- a/mingw-w64-crt/math/modff.c
+++ b/mingw-w64-crt/math/modff.c
@@ -22,7 +22,7 @@ modff (float value, float* iptr)
     "fldcw (%%rsp)\n"
     "frndint\n"
     "fldcw 4(%%rsp)\n"
-    "addq $8, %%rsp\n" : "=t" (int_part) : "0" (value)); /* round */
+    "addq $8, %%rsp\n" : "=t" (int_part) : "0" (value) : "eax"); /* round */
 #elif defined(_X86_) || defined(__i386__)
   asm ("push %%eax\n\tsubl $8, %%esp\n"
     "fnstcw 4(%%esp)\n"
@@ -32,7 +32,7 @@ modff (float value, float* iptr)
     "fldcw (%%esp)\n"
     "frndint\n"
     "fldcw 4(%%esp)\n"
-    "addl $8, %%esp\n\tpop %%eax\n" : "=t" (int_part) : "0" (value)); /* round 
*/
+    "addl $8, %%esp\n\tpop %%eax\n" : "=t" (int_part) : "0" (value) : "eax"); 
/* round */
 #else
   int_part = truncf(value);
 #endif
diff --git a/mingw-w64-crt/math/modfl.c b/mingw-w64-crt/math/modfl.c
index af75a8b8..ef1ab16c 100644
--- a/mingw-w64-crt/math/modfl.c
+++ b/mingw-w64-crt/math/modfl.c
@@ -21,7 +21,7 @@ modfl (long double value, long double* iptr)
     "fldcw (%%rsp)\n"
     "frndint\n"
     "fldcw 4(%%rsp)\n"
-    "addq $8, %%rsp\n" : "=t" (int_part) : "0" (value)); /* round */
+    "addq $8, %%rsp\n" : "=t" (int_part) : "0" (value) : "eax"); /* round */
 #elif defined(_X86_) || defined(__i386__)
   asm ("push %%eax\n\tsubl $8, %%esp\n"
     "fnstcw 4(%%esp)\n"
@@ -31,7 +31,7 @@ modfl (long double value, long double* iptr)
     "fldcw (%%esp)\n"
     "frndint\n"
     "fldcw 4(%%esp)\n"
-    "addl $8, %%esp\n\tpop %%eax\n" : "=t" (int_part) : "0" (value)); /* round 
*/
+    "addl $8, %%esp\n\tpop %%eax\n" : "=t" (int_part) : "0" (value) : "eax"); 
/* round */
 #else
   int_part = truncl(value);
 #endif
-- 
2.14.2

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to