bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

strtold: Work around a Haiku bug


From: Bruno Haible
Subject: strtold: Work around a Haiku bug
Date: Sun, 01 Sep 2024 23:26:44 +0200

On Haiku, I see this test failure:

FAIL: test-strtold
==================

../../gltests/test-strtold.h:527: assertion '0.0L < result && result <= 
LDBL_MIN' failed
Abort
FAIL test-strtold (exit status: 149)

This patch adds a workaround.


2024-09-01  Bruno Haible  <bruno@clisp.org>

        strtold: Work around a Haiku bug.
        * lib/strtod.c (HAVE_UNDERLYING_STRTOD): Set to 0 for 'long double'
        parsing on Haiku.
        * doc/posix-functions/strtold.texi: Mention the bug.

diff --git a/doc/posix-functions/strtold.texi b/doc/posix-functions/strtold.texi
index 3aada2c405..6a9364862e 100644
--- a/doc/posix-functions/strtold.texi
+++ b/doc/posix-functions/strtold.texi
@@ -61,6 +61,11 @@
 @c https://cygwin.com/ml/cygwin/2019-12/msg00072.html
 Cygwin 2.9.
 
+@item
+This function maps denormalized numbers to zero on some platforms:
+@c https://dev.haiku-os.org/ticket/19040
+Haiku 2024.
+
 @item
 This function leaks memory on mingw 5.0
 and allocates an unbounded amount of stack on mingw 9.0.
diff --git a/lib/strtod.c b/lib/strtod.c
index bece59fd68..6c368c458c 100644
--- a/lib/strtod.c
+++ b/lib/strtod.c
@@ -73,6 +73,10 @@
       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
+# elif defined __HAIKU__
+   /* Haiku's strtold maps denormalized numbers to zero.
+      <https://dev.haiku-os.org/ticket/19040>  */
+#  define HAVE_UNDERLYING_STRTOD 0
 # else
 #  define HAVE_UNDERLYING_STRTOD HAVE_STRTOLD
 # endif






reply via email to

[Prev in Thread] Current Thread [Next in Thread]