-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 According to Leo Davis on 11/5/2009 2:27 PM: > Hello, > > I tried building GNU m4 1.4.13 on a MacBook running Snow Leopard (10.6.1 > Intel). > I have Xcode 3.2.1 installed (gcc is i686-apple-darwin10-gcc-4.2.1 (GCC) > 4.2.1 (Apple Inc. build 5646) (dot 1) according to config.log). > > The "make check" failure I'm seeing is: > > test-strtod.c:647: assertion failed > test-strtod.c:648: assertion failed > FAIL: test-strtod
Thanks for the report. From m4's perspective, this only affects use of the format builtin, and only if you are trying to print floating point values, so it's not that bad of a failure. But if it really bothers you, you can run 'gl_cv_func_strtod_works=no ./configure' and the failure should disappear. From gnulib's perspective, it means our strtod.m4 filter is not strict enough to detect the bugs in darwin's strtod() implementation. > > this corresponds to the source lines: > > ASSERT (ptr1 == input + 4); /* OpenBSD 4.0, HP-UX 11.11, > IRIX 6.5, OSF/1 5.1, Solaris 2.5.1, mingw */ > ASSERT (ptr2 == input + 4); /* OpenBSD 4.0, HP-UX 11.11, > IRIX 6.5, OSF/1 5.1, Solaris 2.5.1, mingw */ > > in a block that starts with: > > const char input[] = "+nan("; You may want to report this to Apple, since it is a bug in their libc. Meanwhile, so I can better characterize the bug, can you tell me what offset ptr1 and ptr2 are pointing at? I'm guessing that darwin's strtod is mistakenly consuming the unbalanced '(', since it did parse a NaN. But even without understanding the full extent of the bug, I think this should fix it, so that m4 1.4.14 works out of the box for you. I'm applying this: - -- Don't work too hard, make some time for fun as well! Eric Blake e...@byu.net -----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/ iEYEARECAAYFAkrznTAACgkQ84KuGfSFAYDfsgCggyPj5ErYJp1WqmxwT8fp/gZH 7lIAnijFkvP9PtMxNCNCvVBIC7OWmmh3 =ZCCB -----END PGP SIGNATURE-----
>From 73d863ac524f017ad939fce7d19c35b6feb1246d Mon Sep 17 00:00:00 2001 From: Eric Blake <e...@byu.net> Date: Thu, 5 Nov 2009 20:48:01 -0700 Subject: [PATCH] strtod: detect darwin bug * m4/strtod.m4 (gl_FUNC_STRTOD): Filter out darwin bug on "nan(". Reported by Leo Davis. Signed-off-by: Eric Blake <e...@byu.net> --- ChangeLog | 6 ++++++ m4/strtod.m4 | 10 +++++++++- 2 files changed, 15 insertions(+), 1 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1635de2..e8841d9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2009-11-06 Eric Blake <e...@byu.net> + + strtod: detect darwin bug + * m4/strtod.m4 (gl_FUNC_STRTOD): Filter out darwin bug on "nan(". + Reported by Leo Davis. + 2009-11-05 Eric Blake <e...@byu.net> freopen-safer: new module diff --git a/m4/strtod.m4 b/m4/strtod.m4 index 9769436..3bc8770 100644 --- a/m4/strtod.m4 +++ b/m4/strtod.m4 @@ -1,4 +1,4 @@ -# strtod.m4 serial 12 +# strtod.m4 serial 13 dnl Copyright (C) 2002-2003, 2006-2009 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -64,6 +64,14 @@ numeric_equal (double x, double y) if (numeric_equal (value, value) || term != (string + 5)) return 1; } + { + /* darwin 10.6.1 misparses "nan(". */ + const char *string = "nan("; + char *term; + double value = strtod (string, &term); + if (numeric_equal (value, value) || term != (string + 3)) + return 1; + } ]])], [gl_cv_func_strtod_works=yes], [gl_cv_func_strtod_works=no], -- 1.6.5.rc1