CRT_fp8.c _fpreset function is directly calling the msvcrt/UCRT library
_fpreset function via import symbol.
CRT_fp10.c _fpreset function is currently only calling the x87 fninit
instruction.
The msvcrt/UCRT _fpreset function is not only the x87 fninit instruction
but is doing also some other work, like setting SSE registers or recovering
from state when the function was called from the SIGFPE signal handler
(which is begin called from SEH exception filter dispatcher).
So change the CRT_fp10.c _fpreset function function to call also the
original msvcrt/UCRT _fpreset function and then change the x87 FPU
precision to 10 bits via _controlfp().
---
mingw-w64-crt/crt/CRT_fp10.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/mingw-w64-crt/crt/CRT_fp10.c b/mingw-w64-crt/crt/CRT_fp10.c
index c8a8bfbeebcc..46c077802c3d 100644
--- a/mingw-w64-crt/crt/CRT_fp10.c
+++ b/mingw-w64-crt/crt/CRT_fp10.c
@@ -4,15 +4,16 @@
* No warranty is given; refer to the file DISCLAIMER.PD within this package.
*/
+#include <_mingw.h>
+#include <float.h>
+
+extern void (* __MINGW_IMP_SYMBOL(_fpreset))(void);
void _fpreset (void);
void _fpreset (void)
{
-#ifdef __GNUC__
- __asm__ ("fninit");
-#else /* msvc: */
- __asm fninit;
-#endif
+ (* __MINGW_IMP_SYMBOL(_fpreset))();
+ _controlfp(_PC_64, _MCW_PC);
}
#ifdef __GNUC__
--
2.20.1
_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public