]> Savannah Git Hosting - gnulib.git/commitdiff
strtold: Work around major mingw bugs.
authorBruno Haible <bruno@clisp.org>
Sun, 14 Jul 2024 16:38:16 +0000 (18:38 +0200)
committerBruno Haible <bruno@clisp.org>
Sun, 21 Jul 2024 01:29:13 +0000 (03:29 +0200)
* lib/strtod.c (HAVE_UNDERLYING_STRTOD) [USE_LONG_DOUBLE]: Set to 0 on
mingw versions before 10.0.
* doc/posix-functions/strtold.texi: Mention the mingw bugs.

ChangeLog
doc/posix-functions/strtold.texi
lib/strtod.c

index 2f6c8b5f35958befdb5c49e1f164615b21e09f5d..1e58c67c08931742aa169dac3af42651cd92c35d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2024-07-14  Bruno Haible  <bruno@clisp.org>
+
+       strtold: Work around major mingw bugs.
+       * lib/strtod.c (HAVE_UNDERLYING_STRTOD) [USE_LONG_DOUBLE]: Set to 0 on
+       mingw versions before 10.0.
+       * doc/posix-functions/strtold.texi: Mention the mingw bugs.
+
 2024-07-13  Bruno Haible  <bruno@clisp.org>
 
        stdlib: Support use of clang++ on Ubuntu.
index 01d3b53ecf5707aa9b50dc339c300228d45fdf55..7b13b2dd9376e885b8d5ad4e1c502a428a3053e0 100644 (file)
@@ -67,6 +67,10 @@ HP-UX 11.31/ia64.
 This function fails to set @code{errno} upon underflow on some platforms:
 @c https://cygwin.com/ml/cygwin/2019-12/msg00072.html
 Cygwin 2.9.
+
+@item
+This function leaks memory on mingw 5.0
+and allocates an unbounded amount of stack on mingw 9.0.
 @end itemize
 
 Portability problems not fixed by Gnulib:
index c744d2f43b3dd69af97347c704e95073869e2c34..62e2b870fc9c9d4f893b5656f93b878bca5021ea 100644 (file)
 # elif STRTOLD_HAS_UNDERFLOW_BUG
    /* strtold would not set errno=ERANGE upon underflow.  */
 #  define HAVE_UNDERLYING_STRTOD 0
+# elif defined __MINGW32__ && __MINGW64_VERSION_MAJOR < 10
+   /* strtold is broken in mingw versions before 10.0:
+      - Up to mingw 5.0.x, it leaks memory at every invocation.
+      - Up to mingw 9.0.x, it allocates an unbounded amount of stack.
+      See <https://github.com/mingw-w64/mingw-w64/commit/450309b97b2e839ea02887dfaf0f1d10fb5d40cc>
+      and <https://github.com/mingw-w64/mingw-w64/commit/73806c0709b7e6c0f6587f11a955743670e85470>.  */
+#  define HAVE_UNDERLYING_STRTOD 0
 # else
 #  define HAVE_UNDERLYING_STRTOD HAVE_STRTOLD
 # endif