bug-gnulib
[Top][All Lists]
Advanced

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

Re: snapshot in preparation for m4 1.4.12


From: Eric Blake
Subject: Re: snapshot in preparation for m4 1.4.12
Date: Fri, 12 Sep 2008 06:53:49 -0600
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.16) Gecko/20080708 Thunderbird/2.0.0.16 Mnenhy/0.7.5.666

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

According to Thomas Klausner on 8/23/2008 10:11 AM:
>>> When stepping through test-frexp with gdb, it fails like this:
>>> (gdb) s
>>> 113         ASSERT (signbit (mantissa));
>> Thanks for the trace.  That occurs after the damage is already done; how
>> about setting a breakpoint at line 110 (the call to frexp), and stepping
>> through that?  Also, is rpl_frexp in use, or is gnulib deferring to your
>> native frexp?
> 
> Breakpoint 1, main () at test-frexp.c:110
> 110         mantissa = frexp (x, &exp);
> (gdb) s
> 111         ASSERT (exp == 0);
> 
> Seems it's using NetBSD's native frexp.
> I just retested 1.4.11 and it now fails there as well, so perhaps
> something changed in NetBSD since my previous test (a few months ago).

I'm committing this.  It looks like your flavor of NetBSD now handles
denormals, but still fails on negative zero.

- --
Don't work too hard, make some time for fun as well!

Eric Blake             address@hidden
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkjKZl0ACgkQ84KuGfSFAYBkGQCgqTfPCau/h6g4j62ltauhcPfi
QKQAoNAPR3nLEv9U71XVkFBRRWcQS4r6
=WbM0
-----END PGP SIGNATURE-----
>From 314fcbb7de94709b92edf1b68f62ca6aed8d4dbc Mon Sep 17 00:00:00 2001
From: Eric Blake <address@hidden>
Date: Fri, 12 Sep 2008 06:52:41 -0600
Subject: [PATCH] frexp: test for NetBSD failure on -0.0

* m4/frexp.m4 (gl_FUNC_FREXP_WORKS): Enhance test, since some, but
not all, bugs from NetBSD 3.0 have been fixed.
* doc/posix-functions/frexp.texi (frexp): Document bug.
Reported by Thomas Klausner.

Signed-off-by: Eric Blake <address@hidden>
---
 ChangeLog                      |    6 ++++++
 doc/posix-functions/frexp.texi |    3 +++
 m4/frexp.m4                    |   19 ++++++++++++++++---
 3 files changed, 25 insertions(+), 3 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index bf7fcc9..414b8e4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2008-09-12  Eric Blake  <address@hidden>
 
+       frexp: test for NetBSD failure on -0.0
+       * m4/frexp.m4 (gl_FUNC_FREXP_WORKS): Enhance test, since some, but
+       not all, bugs from NetBSD 3.0 have been fixed.
+       * doc/posix-functions/frexp.texi (frexp): Document bug.
+       Reported by Thomas Klausner.
+
        signbit: work around bug of HP-UX 10.20 cc with -0.0 literal
        * m4/signbit.m4 (gl_SIGNBIT_TEST_PROGRAM): Rewrite test to avoid
        literal -0.0.
diff --git a/doc/posix-functions/frexp.texi b/doc/posix-functions/frexp.texi
index f0a791c..345ce74 100644
--- a/doc/posix-functions/frexp.texi
+++ b/doc/posix-functions/frexp.texi
@@ -12,6 +12,9 @@ Portability problems fixed by Gnulib:
 This function does not work on denormalized numbers on some platforms:
 NetBSD 3.0.
 @item
+This function does not work on negative zero on some platforms:
+NetBSD 4.99.
address@hidden
 This function does not work on infinite numbers on some platforms:
 IRIX 6.5, mingw.
 @end itemize
diff --git a/m4/frexp.m4 b/m4/frexp.m4
index ce031e7..11ed059 100644
--- a/m4/frexp.m4
+++ b/m4/frexp.m4
@@ -1,5 +1,5 @@
-# frexp.m4 serial 5
-dnl Copyright (C) 2007 Free Software Foundation, Inc.
+# frexp.m4 serial 6
+dnl Copyright (C) 2007, 2008 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
@@ -88,7 +88,8 @@ AC_DEFUN([gl_FUNC_FREXP_NO_LIBM],
 ])
 
 dnl Test whether frexp() works also on denormalized numbers (this fails e.g. on
-dnl NetBSD 3.0) and on infinite numbers (this fails e.g. on IRIX 6.5 and 
mingw).
+dnl NetBSD 3.0), on infinite numbers (this fails e.g. on IRIX 6.5 and mingw),
+dnl and on negative zero (this fails e.g. on NetBSD 4.99).
 AC_DEFUN([gl_FUNC_FREXP_WORKS],
 [
   AC_REQUIRE([AC_PROG_CC])
@@ -98,10 +99,14 @@ AC_DEFUN([gl_FUNC_FREXP_WORKS],
       AC_TRY_RUN([
 #include <float.h>
 #include <math.h>
+#include <string.h>
 int main()
 {
   int i;
   volatile double x;
+/* HP cc on HP-UX 10.20 has a bug with the constant expression -0.0.
+   So we use -zero instead.  */
+  double zero = 0.0;
   /* Test on denormalized numbers.  */
   for (i = 1, x = 1.0; i >= DBL_MIN_EXP; i--, x *= 0.5)
     ;
@@ -122,6 +127,14 @@ int main()
     if (y != x)
       return 1;
   }
+  /* Test on negative zero.  */
+  x = -zero;
+  {
+    int exp;
+    double y = frexp (x, &exp);
+    if (memcmp (&y, &x, sizeof x))
+      return 1;
+  }
   return 0;
 }], [gl_cv_func_frexp_works=yes], [gl_cv_func_frexp_works=no],
       [case "$host_os" in
-- 
1.6.0


reply via email to

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