The __mingw_*scanf functions use __mingw_strtold for both double and
long double output, but previously the __mingw_strtold function
produced the x86 80 bit long double format, regardless of architecture.

Instead skip the function that produces 80 bit doubles, and make
__mingw_strtold an alias for __mingw_strtod.

Signed-off-by: Martin Storsjö <[email protected]>
---
 mingw-w64-crt/gdtoa/strtodnrp.c | 9 +++++++++
 mingw-w64-crt/gdtoa/strtopx.c   | 5 +++++
 2 files changed, 14 insertions(+)

diff --git a/mingw-w64-crt/gdtoa/strtodnrp.c b/mingw-w64-crt/gdtoa/strtodnrp.c
index 9f13de64c..a7b9972ff 100644
--- a/mingw-w64-crt/gdtoa/strtodnrp.c
+++ b/mingw-w64-crt/gdtoa/strtodnrp.c
@@ -85,3 +85,12 @@ double __cdecl
 __mingw_strtod (const char * __restrict__ src, char ** __restrict__ endptr)
   __attribute__((alias("__strtod")));
 
+#if !(defined(_AMD64_) || defined(__x86_64__) || \
+  defined(_X86_) || defined(__i386__))
+/* For systems other than x86, where long double == double, provide the
+ * long double functions as aliases to __strtod. */
+
+long double __cdecl
+__mingw_strtold (const char * __restrict__ src, char ** __restrict__ endptr)
+  __attribute__((alias("__strtod")));
+#endif
diff --git a/mingw-w64-crt/gdtoa/strtopx.c b/mingw-w64-crt/gdtoa/strtopx.c
index b077105be..64db719e0 100644
--- a/mingw-w64-crt/gdtoa/strtopx.c
+++ b/mingw-w64-crt/gdtoa/strtopx.c
@@ -51,6 +51,10 @@ THIS SOFTWARE.
 #define _4 0
 #endif
 
+/* This is specific to the x86 80 bit long doubles. */
+#if defined(_AMD64_) || defined(__x86_64__) || \
+  defined(_X86_) || defined(__i386__)
+
 typedef union lD {
        UShort L[5];
        long double D;
@@ -123,3 +127,4 @@ long double __cdecl
 __mingw_strtold (const char * __restrict__ src, char ** __restrict__ endptr)
   __attribute__((alias("__strtold")));
 
+#endif
-- 
2.17.1



_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to