bug-gnulib
[Top][All Lists]
Advanced

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

test-ceilf-ieee failures


From: Bruno Haible
Subject: test-ceilf-ieee failures
Date: Sun, 19 Jun 2011 12:48:47 +0200
User-agent: KMail/1.9.9

>       3 x FAIL: test-ceilf-ieee

The failures on AIX 6.1, AIX 7.1 are worked around by this patch:


2011-06-19  Bruno Haible  <address@hidden>

        ceilf-ieee: Work around bug on AIX 7.1.
        * m4/ceilf.m4 (gl_FUNC_CEILF): Test also the sign of ceilf (-0.3f).
        * doc/posix-functions/ceilf.texi: Mention the AIX 7.1 problem.

--- doc/posix-functions/ceilf.texi.orig Sun Jun 19 11:53:53 2011
+++ doc/posix-functions/ceilf.texi      Sun Jun 19 11:53:41 2011
@@ -16,6 +16,10 @@
 Portability problems fixed by Gnulib module @code{ceilf-ieee}:
 @itemize
 @item
+This function returns a positive zero for an argument between -1 and 0
+on some platforms:
+AIX 7.1.
address@hidden
 This function returns a positive zero for a minus zero argument
 on some platforms:
 OSF/1 5.1.
--- m4/ceilf.m4.orig    Sun Jun 19 11:53:53 2011
+++ m4/ceilf.m4 Sun Jun 19 11:38:27 2011
@@ -1,4 +1,4 @@
-# ceilf.m4 serial 9
+# ceilf.m4 serial 10
 dnl Copyright (C) 2007, 2009-2011 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -37,10 +37,14 @@
 ]gl_FLOAT_SIGNBIT_CODE[
 int main()
 {
+  int result = 0;
   /* Test whether ceilf (-0.0f) is -0.0f.  */
   if (signbitf (minus_zerof) && !signbitf (ceilf (minus_zerof)))
-    return 1;
-  return 0;
+    result |= 1;
+  /* Test whether ceilf (-0.3f) is -0.0f.  */
+  if (signbitf (-0.3f) && !signbitf (ceilf (-0.3f)))
+    result |= 2;
+  return result;
 }
               ]])],
               [gl_cv_func_ceilf_ieee=yes],


The failure on MacOS X 10.5 has the same cause, but the workaround is not
sufficient because in the configure-time test program, gcc optimizations
blur the result. This fixes it:


2011-06-19  Bruno Haible  <address@hidden>

        floor*-ieee, ceil*-ieee, trunc*-ieee, round*-ieee: More robust checks.
        * m4/floorf.m4 (gl_FUNC_FLOORF): In the test whether the function is
        IEEE compliant, avoid compiler optimizations.
        * m4/floor.m4 (gl_FUNC_FLOOR): Likewise.
        * m4/ceilf.m4 (gl_FUNC_CEILF): Likewise.
        * m4/ceil.m4 (gl_FUNC_CEIL): Likewise.
        * m4/ceill.m4 (gl_FUNC_CEILL): Likewise.
        * m4/truncf.m4 (gl_FUNC_TRUNCF): Likewise.
        * m4/trunc.m4 (gl_FUNC_TRUNC): Likewise.
        * m4/truncl.m4 (gl_FUNC_TRUNCL): Likewise.
        * m4/roundf.m4 (gl_FUNC_ROUNDF): Likewise.
        * m4/round.m4 (gl_FUNC_ROUND): Likewise.
        * m4/roundl.m4 (gl_FUNC_ROUNDL): Likewise.

--- m4/ceil.m4.orig     Sun Jun 19 12:41:59 2011
+++ m4/ceil.m4  Sun Jun 19 12:08:33 2011
@@ -1,4 +1,4 @@
-# ceil.m4 serial 7
+# ceil.m4 serial 8
 dnl Copyright (C) 2007, 2009-2011 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -28,14 +28,16 @@
 #include <math.h>
 ]gl_DOUBLE_MINUS_ZERO_CODE[
 ]gl_DOUBLE_SIGNBIT_CODE[
-int main()
+static double dummy (double f) { return 0; }
+int main (int argc, char *argv[])
 {
+  double (*my_ceil) (double) = argc ? ceil : dummy;
   int result = 0;
   /* Test whether ceil (-0.0) is -0.0.  */
-  if (signbitd (minus_zerod) && !signbitd (ceil (minus_zerod)))
+  if (signbitd (minus_zerod) && !signbitd (my_ceil (minus_zerod)))
     result |= 1;
   /* Test whether ceil (-0.3) is -0.0.  */
-  if (signbitd (-0.3) && !signbitd (ceil (-0.3)))
+  if (signbitd (-0.3) && !signbitd (my_ceil (-0.3)))
     result |= 2;
   return result;
 }
--- m4/ceilf.m4.orig    Sun Jun 19 12:41:59 2011
+++ m4/ceilf.m4 Sun Jun 19 12:08:32 2011
@@ -1,4 +1,4 @@
-# ceilf.m4 serial 10
+# ceilf.m4 serial 11
 dnl Copyright (C) 2007, 2009-2011 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -35,14 +35,16 @@
 #include <math.h>
 ]gl_FLOAT_MINUS_ZERO_CODE[
 ]gl_FLOAT_SIGNBIT_CODE[
-int main()
+static float dummy (float f) { return 0; }
+int main (int argc, char *argv[])
 {
+  float (*my_ceilf) (float) = argc ? ceilf : dummy;
   int result = 0;
   /* Test whether ceilf (-0.0f) is -0.0f.  */
-  if (signbitf (minus_zerof) && !signbitf (ceilf (minus_zerof)))
+  if (signbitf (minus_zerof) && !signbitf (my_ceilf (minus_zerof)))
     result |= 1;
   /* Test whether ceilf (-0.3f) is -0.0f.  */
-  if (signbitf (-0.3f) && !signbitf (ceilf (-0.3f)))
+  if (signbitf (-0.3f) && !signbitf (my_ceilf (-0.3f)))
     result |= 2;
   return result;
 }
--- m4/ceill.m4.orig    Sun Jun 19 12:41:59 2011
+++ m4/ceill.m4 Sun Jun 19 12:08:32 2011
@@ -1,4 +1,4 @@
-# ceill.m4 serial 9
+# ceill.m4 serial 10
 dnl Copyright (C) 2007, 2009-2011 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -35,10 +35,12 @@
 #include <math.h>
 ]gl_LONG_DOUBLE_MINUS_ZERO_CODE[
 ]gl_LONG_DOUBLE_SIGNBIT_CODE[
-int main()
+static long double dummy (long double f) { return 0; }
+int main (int argc, char *argv[])
 {
+  long double (*my_ceill) (long double) = argc ? ceill : dummy;
   /* Test whether ceill (-0.3L) is -0.0L.  */
-  if (signbitl (minus_zerol) && !signbitl (ceill (-0.3L)))
+  if (signbitl (minus_zerol) && !signbitl (my_ceill (-0.3L)))
     return 1;
   return 0;
 }
--- m4/floor.m4.orig    Sun Jun 19 12:41:59 2011
+++ m4/floor.m4 Sun Jun 19 12:08:33 2011
@@ -1,4 +1,4 @@
-# floor.m4 serial 6
+# floor.m4 serial 7
 dnl Copyright (C) 2007, 2009-2011 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -28,10 +28,12 @@
 #include <math.h>
 ]gl_DOUBLE_MINUS_ZERO_CODE[
 ]gl_DOUBLE_SIGNBIT_CODE[
-int main()
+static double dummy (double f) { return 0; }
+int main (int argc, char *argv[])
 {
+  double (*my_floor) (double) = argc ? floor : dummy;
   /* Test whether floor (-0.0) is -0.0.  */
-  if (signbitd (minus_zerod) && !signbitd (floor (minus_zerod)))
+  if (signbitd (minus_zerod) && !signbitd (my_floor (minus_zerod)))
     return 1;
   return 0;
 }
--- m4/floorf.m4.orig   Sun Jun 19 12:41:59 2011
+++ m4/floorf.m4        Sun Jun 19 12:08:33 2011
@@ -1,4 +1,4 @@
-# floorf.m4 serial 9
+# floorf.m4 serial 10
 dnl Copyright (C) 2007, 2009-2011 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -35,10 +35,12 @@
 #include <math.h>
 ]gl_FLOAT_MINUS_ZERO_CODE[
 ]gl_FLOAT_SIGNBIT_CODE[
-int main()
+static float dummy (float f) { return 0; }
+int main (int argc, char *argv[])
 {
+  float (*my_floorf) (float) = argc ? floorf : dummy;
   /* Test whether floorf (-0.0f) is -0.0f.  */
-  if (signbitf (minus_zerof) && !signbitf (floorf (minus_zerof)))
+  if (signbitf (minus_zerof) && !signbitf (my_floorf (minus_zerof)))
     return 1;
   return 0;
 }
--- m4/round.m4.orig    Sun Jun 19 12:41:59 2011
+++ m4/round.m4 Sun Jun 19 12:08:33 2011
@@ -1,4 +1,4 @@
-# round.m4 serial 11
+# round.m4 serial 12
 dnl Copyright (C) 2007, 2009-2011 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -69,10 +69,12 @@
 #include <math.h>
 ]gl_DOUBLE_MINUS_ZERO_CODE[
 ]gl_DOUBLE_SIGNBIT_CODE[
-int main()
+static double dummy (double f) { return 0; }
+int main (int argc, char *argv[])
 {
+  double (*my_round) (double) = argc ? round : dummy;
   /* Test whether round (-0.0) is -0.0.  */
-  if (signbitd (minus_zerod) && !signbitd (round (minus_zerod)))
+  if (signbitd (minus_zerod) && !signbitd (my_round (minus_zerod)))
     return 1;
   return 0;
 }
--- m4/roundf.m4.orig   Sun Jun 19 12:41:59 2011
+++ m4/roundf.m4        Sun Jun 19 12:08:33 2011
@@ -1,4 +1,4 @@
-# roundf.m4 serial 11
+# roundf.m4 serial 12
 dnl Copyright (C) 2007-2011 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -66,10 +66,12 @@
 #include <math.h>
 ]gl_FLOAT_MINUS_ZERO_CODE[
 ]gl_FLOAT_SIGNBIT_CODE[
-int main()
+static float dummy (float f) { return 0; }
+int main (int argc, char *argv[])
 {
+  float (*my_roundf) (float) = argc ? roundf : dummy;
   /* Test whether roundf (-0.0f) is -0.0f.  */
-  if (signbitf (minus_zerof) && !signbitf (roundf (minus_zerof)))
+  if (signbitf (minus_zerof) && !signbitf (my_roundf (minus_zerof)))
     return 1;
   return 0;
 }
--- m4/roundl.m4.orig   Sun Jun 19 12:41:59 2011
+++ m4/roundl.m4        Sun Jun 19 12:08:33 2011
@@ -1,4 +1,4 @@
-# roundl.m4 serial 9
+# roundl.m4 serial 10
 dnl Copyright (C) 2007, 2009-2011 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -31,10 +31,12 @@
 #include <math.h>
 ]gl_LONG_DOUBLE_MINUS_ZERO_CODE[
 ]gl_LONG_DOUBLE_SIGNBIT_CODE[
-int main()
+static long double dummy (long double f) { return 0; }
+int main (int argc, char *argv[])
 {
+  long double (*my_roundl) (long double) = argc ? roundl : dummy;
   /* Test whether roundl (-0.0L) is -0.0L.  */
-  if (signbitl (minus_zerol) && !signbitl (roundl (minus_zerol)))
+  if (signbitl (minus_zerol) && !signbitl (my_roundl (minus_zerol)))
     return 1;
   return 0;
 }
--- m4/trunc.m4.orig    Sun Jun 19 12:41:59 2011
+++ m4/trunc.m4 Sun Jun 19 12:08:34 2011
@@ -1,4 +1,4 @@
-# trunc.m4 serial 6
+# trunc.m4 serial 7
 dnl Copyright (C) 2007, 2010-2011 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -56,10 +56,12 @@
 #include <math.h>
 ]gl_DOUBLE_MINUS_ZERO_CODE[
 ]gl_DOUBLE_SIGNBIT_CODE[
-int main()
+static double dummy (double f) { return 0; }
+int main (int argc, char *argv[])
 {
+  double (*my_trunc) (double) = argc ? trunc : dummy;
   /* Test whether trunc (-0.0) is -0.0.  */
-  if (signbitd (minus_zerod) && !signbitd (trunc (minus_zerod)))
+  if (signbitd (minus_zerod) && !signbitd (my_trunc (minus_zerod)))
     return 1;
   return 0;
 }
--- m4/truncf.m4.orig   Sun Jun 19 12:41:59 2011
+++ m4/truncf.m4        Sun Jun 19 12:08:34 2011
@@ -1,4 +1,4 @@
-# truncf.m4 serial 5
+# truncf.m4 serial 6
 dnl Copyright (C) 2007, 2010-2011 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -56,10 +56,12 @@
 #include <math.h>
 ]gl_FLOAT_MINUS_ZERO_CODE[
 ]gl_FLOAT_SIGNBIT_CODE[
-int main()
+static float dummy (float f) { return 0; }
+int main (int argc, char *argv[])
 {
+  float (*my_truncf) (float) = argc ? truncf : dummy;
   /* Test whether truncf (-0.0f) is -0.0f.  */
-  if (signbitf (minus_zerof) && !signbitf (truncf (minus_zerof)))
+  if (signbitf (minus_zerof) && !signbitf (my_truncf (minus_zerof)))
     return 1;
   return 0;
 }
--- m4/truncl.m4.orig   Sun Jun 19 12:41:59 2011
+++ m4/truncl.m4        Sun Jun 19 12:08:34 2011
@@ -1,4 +1,4 @@
-# truncl.m4 serial 7
+# truncl.m4 serial 8
 dnl Copyright (C) 2007-2008, 2010-2011 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -84,10 +84,12 @@
 #include <math.h>
 ]gl_LONG_DOUBLE_MINUS_ZERO_CODE[
 ]gl_LONG_DOUBLE_SIGNBIT_CODE[
-int main()
+static long double dummy (long double f) { return 0; }
+int main (int argc, char *argv[])
 {
+  long double (*my_truncl) (long double) = argc ? truncl : dummy;
   /* Test whether truncl (-0.3L) is -0.0L.  */
-  if (signbitl (minus_zerol) && !signbitl (truncl (-0.3L)))
+  if (signbitl (minus_zerol) && !signbitl (my_truncl (-0.3L)))
     return 1;
   return 0;
 }

-- 
In memoriam Alois Eliáš <http://en.wikipedia.org/wiki/Alois_Eliáš>



reply via email to

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