From: Bruno Haible Date: Tue, 9 Dec 2008 01:28:20 +0000 (+0100) Subject: Detect a dysfunctional signbit macro on MacOS X 10.4/PowerPC. X-Git-Tag: v0.1~6623 X-Git-Url: http://erislabs.org.uk/gitweb/?a=commitdiff_plain;h=b17f7f0fb459a428a2a9f26ae202aa2256f08192;p=gnulib.git Detect a dysfunctional signbit macro on MacOS X 10.4/PowerPC. --- diff --git a/ChangeLog b/ChangeLog index c52a8db22..2cf0681e7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2008-12-08 Bruno Haible + + * m4/signbitl.m4 (gl_SIGNBIT_TEST_PROGRAM): Add a link check of signbit + applied to variables. Needed on MacOS X 10.4/PowerPC. + Reported by Simon Josefsson. + 2008-12-08 William Pursell (tiny change) and Eric Blake diff --git a/m4/signbit.m4 b/m4/signbit.m4 index e9c1e37f3..05d2a0596 100644 --- a/m4/signbit.m4 +++ b/m4/signbit.m4 @@ -1,4 +1,4 @@ -# signbit.m4 serial 4 +# signbit.m4 serial 5 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, @@ -124,6 +124,12 @@ AC_DEFUN([gl_SIGNBIT], ]) AC_DEFUN([gl_SIGNBIT_TEST_PROGRAM], [[ +/* Global variables. + Needed because GCC 4 constant-folds __builtin_signbitl (literal) + but cannot constant-fold __builtin_signbitl (variable). */ +float vf; +double vd; +long double vl; int main () { /* HP cc on HP-UX 10.20 has a bug with the constant expression -0.0. @@ -142,6 +148,8 @@ long double m0l = -LDBL_MIN * LDBL_MIN; #else long double m0l = -p0l; #endif + if (signbit (vf)) + vf++; { float plus_inf = 1.0f / p0f; float minus_inf = -1.0f / p0f; @@ -153,6 +161,8 @@ long double m0l = -p0l; && signbit (minus_inf))) return 1; } + if (signbit (vd)) + vd++; { double plus_inf = 1.0 / p0d; double minus_inf = -1.0 / p0d; @@ -164,6 +174,8 @@ long double m0l = -p0l; && signbit (minus_inf))) return 1; } + if (signbit (vl)) + vl++; { long double plus_inf = 1.0L / p0l; long double minus_inf = -1.0L / p0l;