bug-m4
[Top][All Lists]
Advanced

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

Re: m4-1.4.11 test-strtod.c fails with 5 asserts


From: Eric Blake
Subject: Re: m4-1.4.11 test-strtod.c fails with 5 asserts
Date: Wed, 16 Apr 2008 20:05:11 -0600
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.12) Gecko/20080213 Thunderbird/2.0.0.12 Mnenhy/0.7.5.666

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

According to Eric Blake on 4/16/2008 2:15 PM:
| | glibc 2.7
| | FAIL: test-strtod
| |
| | All other tests pass.
|
| All five of these deal with a bug in parsing "nan()", which is present in
| older glibc (but if I understand the glibc bug reports correctly, is fixed
| in CVS).  Since m4-1.4.11 was released, strtod.m4 has already been beefed
| up to catch other bugs, but I'm not sure if this particular bug is
| filtered in strtod.m4 yet.

I'm committing this to gnulib.  Then I regenerated my m4 snapshot; would
you please try it and see if it resolves the failure?

http://home.comcast.net/~ericblake/m4-1.4.10b.27-14840.tar.gz
http://home.comcast.net/~ericblake/m4-1.4.10b.27-14840.tar.gz.asc
http://home.comcast.net/~ericblake/m4-1.4.10b.27-14840.tar.bz2
http://home.comcast.net/~ericblake/m4-1.4.10b.27-14840.tar.bz2.asc

By the way, would you like to be attributed in the ChangeLog by something
other than BuraphaLinux or JGH?

- --
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

iEYEARECAAYFAkgGr+EACgkQ84KuGfSFAYCf2QCfWa33g8tgabh7Zgpyr0UTtEph
1FYAoJP9g5Da2jgJzO7+2z8i2BsmvnJP
=Nu1P
-----END PGP SIGNATURE-----
From 6b61508657346fdef38811f73bc1643879752862 Mon Sep 17 00:00:00 2001
From: Eric Blake <address@hidden>
Date: Wed, 16 Apr 2008 19:28:29 -0600
Subject: [PATCH] Adjust strtod detection to catch glibc 2.7 bug.

* m4/strtod.m4 (gl_FUNC_STRTOD): Test "nan()" behavior.
Reported by BuraphaLinux Server.

Signed-off-by: Eric Blake <address@hidden>
---
 ChangeLog    |    6 ++++++
 m4/strtod.m4 |   18 +++++++++++++++++-
 2 files changed, 23 insertions(+), 1 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 8f8a6f2..2f1d444 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2008-04-16  Eric Blake  <address@hidden>
+
+       Adjust strtod detection to catch glibc 2.7 bug.
+       * m4/strtod.m4 (gl_FUNC_STRTOD): Test "nan()" behavior.
+       Reported by BuraphaLinux Server.
+
 2008-04-16  Bruno Haible  <address@hidden>
 
        Add tentative support for Linux libc5.
diff --git a/m4/strtod.m4 b/m4/strtod.m4
index ba411a9..5d52617 100644
--- a/m4/strtod.m4
+++ b/m4/strtod.m4
@@ -1,4 +1,4 @@
-# strtod.m4 serial 8
+# strtod.m4 serial 9
 dnl Copyright (C) 2002, 2003, 2006, 2007, 2008 Free Software
 dnl Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
@@ -19,6 +19,14 @@ AC_DEFUN([gl_FUNC_STRTOD],
       [AC_RUN_IFELSE([AC_LANG_PROGRAM([[
 #include <stdlib.h>
 #include <math.h>
+/* Compare two numbers with ==.
+   This is a separate function because IRIX 6.5 "cc -O" miscompiles an
+   'x == x' test.  */
+static int
+numeric_equal (double x, double y)
+{
+  return x == y;
+}
 ]], [[
   {
     /* Older glibc and Cygwin mis-parse "-0x".  */
@@ -45,6 +53,14 @@ AC_DEFUN([gl_FUNC_STRTOD],
     if (value != HUGE_VAL || term != (string + 3))
       return 1;
   }
+  {
+    /* glibc 2.7 and cygwin 1.5.24 misparse "nan()".  */
+    const char *string = "nan()";
+    char *term;
+    double value = strtod (string, &term);
+    if (numeric_equal (value, value) || term != (string + 5))
+      return 1;
+  }
 ]])],
        [gl_cv_func_strtod_works=yes],
        [gl_cv_func_strtod_works=no],
-- 
1.5.5


reply via email to

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