bug-gnulib@gnu.org mirror (unofficial)
 help / color / mirror / Atom feed
* ilogb, ilogbl: Fix test failures on AIX 7.1 in 64-bit mode
@ 2021-01-06 10:14 Bruno Haible
  0 siblings, 0 replies; only message in thread
From: Bruno Haible @ 2021-01-06 10:14 UTC (permalink / raw)
  To: bug-gnulib

[-- Attachment #1: Type: text/plain, Size: 788 bytes --]

These two patches fix test failures

test-ilogb.log
../../gltests/test-ilogb.h:85: assertion 'y == i - 1' failed
FAIL test-ilogb (exit status: 134)

test-ilogbl.log
../../gltests/test-ilogb.h:85: assertion 'y == i - 1' failed
FAIL test-ilogbl (exit status: 134)

seen on AIX 7.1 in 64-bit mode, by adding workarounds.


2021-01-06  Bruno Haible  <bruno@clisp.org>

	ilogbl: Fix test failures on AIX 7.1 in 64-bit mode.
	* m4/ilogbl.m4 (gl_FUNC_ILOGBL_WORKS): Test also some denormalized
	argument.
	* doc/posix-functions/ilogbl.texi: Mention the AIX bug.

2021-01-06  Bruno Haible  <bruno@clisp.org>

	ilogb: Fix test failures on AIX 7.1 in 64-bit mode.
	* m4/ilogb.m4 (gl_FUNC_ILOGB_WORKS): Test also some denormalized
	argument.
	* doc/posix-functions/ilogb.texi: Mention the AIX bug.


[-- Attachment #2: 0001-ilogb-Fix-test-failures-on-AIX-7.1-in-64-bit-mode.patch --]
[-- Type: text/x-patch, Size: 3146 bytes --]

From 1ac1751add634045d353c5ff1eb8f435737bc1ea Mon Sep 17 00:00:00 2001
From: Bruno Haible <bruno@clisp.org>
Date: Wed, 6 Jan 2021 11:06:25 +0100
Subject: [PATCH 1/2] ilogb: Fix test failures on AIX 7.1 in 64-bit mode.

* m4/ilogb.m4 (gl_FUNC_ILOGB_WORKS): Test also some denormalized
argument.
* doc/posix-functions/ilogb.texi: Mention the AIX bug.
---
 ChangeLog                      |  7 +++++++
 doc/posix-functions/ilogb.texi |  3 +++
 m4/ilogb.m4                    | 17 ++++++++++++++---
 3 files changed, 24 insertions(+), 3 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index a86fe7e..2adaf5a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2021-01-06  Bruno Haible  <bruno@clisp.org>
+
+	ilogb: Fix test failures on AIX 7.1 in 64-bit mode.
+	* m4/ilogb.m4 (gl_FUNC_ILOGB_WORKS): Test also some denormalized
+	argument.
+	* doc/posix-functions/ilogb.texi: Mention the AIX bug.
+
 2021-01-05  Bruno Haible  <bruno@clisp.org>
 
 	fclose: Fix test failure on AIX 7.2.
diff --git a/doc/posix-functions/ilogb.texi b/doc/posix-functions/ilogb.texi
index 1b26676..edcba7c 100644
--- a/doc/posix-functions/ilogb.texi
+++ b/doc/posix-functions/ilogb.texi
@@ -15,6 +15,9 @@ Minix 3.1.8, MSVC 9.
 This function returns a wrong result for a zero argument on some platforms:
 OpenBSD 6.7, AIX 5.1.
 @item
+This function returns a wrong result for denormalized arguments on some platforms:
+AIX 7.1 64-bit.
+@item
 This function returns a wrong result for an infinite argument on some platforms:
 NetBSD 7.1, OpenBSD 6.7.
 @item
diff --git a/m4/ilogb.m4 b/m4/ilogb.m4
index 29e472c..5404390 100644
--- a/m4/ilogb.m4
+++ b/m4/ilogb.m4
@@ -1,4 +1,4 @@
-# ilogb.m4 serial 6
+# ilogb.m4 serial 7
 dnl Copyright (C) 2010-2021 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -44,6 +44,7 @@ AC_DEFUN([gl_FUNC_ILOGB],
 
 dnl Test whether ilogb() works.
 dnl On OpenBSD 6.7, AIX 5.1, ilogb(0.0) is wrong.
+dnl On AIX 7.1 in 64-bit mode, ilogb(2^(DBL_MIN_EXP-1)) is wrong.
 dnl On NetBSD 7.1, OpenBSD 6.7, ilogb(Infinity) is wrong.
 dnl On NetBSD 7.1, OpenBSD 6.7, ilogb(NaN) is wrong.
 AC_DEFUN([gl_FUNC_ILOGB_WORKS],
@@ -54,6 +55,7 @@ AC_DEFUN([gl_FUNC_ILOGB_WORKS],
     [
       AC_RUN_IFELSE(
         [AC_LANG_SOURCE([[
+#include <float.h>
 #include <limits.h>
 #include <math.h>
 /* Provide FP_ILOGB0, FP_ILOGBNAN, like in math.in.h.  */
@@ -93,17 +95,26 @@ int main (int argc, char *argv[])
     if (my_ilogb (x) != FP_ILOGB0)
       result |= 1;
   }
+  /* This test fails on AIX 7.1 in 64-bit mode.  */
+  {
+    int i;
+    x = 0.5;
+    for (i = DBL_MIN_EXP - 1; i < 0; i++)
+      x = x * 0.5;
+    if (x > 0.0 && my_ilogb (x) != DBL_MIN_EXP - 2)
+      result |= 2;
+  }
   /* This test fails on NetBSD 7.1, OpenBSD 6.7.  */
   {
     x = 1.0 / zero;
     if (my_ilogb (x) != INT_MAX)
-      result |= 2;
+      result |= 4;
   }
   /* This test fails on NetBSD 7.1, OpenBSD 6.7.  */
   {
     x = zero / zero;
     if (my_ilogb (x) != FP_ILOGBNAN)
-      result |= 4;
+      result |= 8;
   }
   return result;
 }
-- 
2.7.4


[-- Attachment #3: 0002-ilogbl-Fix-test-failures-on-AIX-7.1-in-64-bit-mode.patch --]
[-- Type: text/x-patch, Size: 3452 bytes --]

From fde3f75ddc3ba2cbfa23cde1d64c5b363e2fb2d0 Mon Sep 17 00:00:00 2001
From: Bruno Haible <bruno@clisp.org>
Date: Wed, 6 Jan 2021 11:06:55 +0100
Subject: [PATCH 2/2] ilogbl: Fix test failures on AIX 7.1 in 64-bit mode.

* m4/ilogbl.m4 (gl_FUNC_ILOGBL_WORKS): Test also some denormalized
argument.
* doc/posix-functions/ilogbl.texi: Mention the AIX bug.
---
 ChangeLog                       |  7 +++++++
 doc/posix-functions/ilogbl.texi |  2 +-
 m4/ilogbl.m4                    | 19 +++++++++++++++----
 3 files changed, 23 insertions(+), 5 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 2adaf5a..9b99954 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
 2021-01-06  Bruno Haible  <bruno@clisp.org>
 
+	ilogbl: Fix test failures on AIX 7.1 in 64-bit mode.
+	* m4/ilogbl.m4 (gl_FUNC_ILOGBL_WORKS): Test also some denormalized
+	argument.
+	* doc/posix-functions/ilogbl.texi: Mention the AIX bug.
+
+2021-01-06  Bruno Haible  <bruno@clisp.org>
+
 	ilogb: Fix test failures on AIX 7.1 in 64-bit mode.
 	* m4/ilogb.m4 (gl_FUNC_ILOGB_WORKS): Test also some denormalized
 	argument.
diff --git a/doc/posix-functions/ilogbl.texi b/doc/posix-functions/ilogbl.texi
index d805e08..a038376 100644
--- a/doc/posix-functions/ilogbl.texi
+++ b/doc/posix-functions/ilogbl.texi
@@ -17,7 +17,7 @@ This function returns a wrong result for a zero argument on some platforms:
 Cygwin 2.9.
 @item
 This function returns a wrong result for denormalized arguments on some platforms:
-Haiku 2017.
+AIX 7.1 64-bit, Haiku 2017.
 @end itemize
 
 Portability problems not fixed by Gnulib:
diff --git a/m4/ilogbl.m4 b/m4/ilogbl.m4
index 3575736..77830c1 100644
--- a/m4/ilogbl.m4
+++ b/m4/ilogbl.m4
@@ -1,4 +1,4 @@
-# ilogbl.m4 serial 4
+# ilogbl.m4 serial 5
 dnl Copyright (C) 2010-2021 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -71,7 +71,8 @@ AC_DEFUN([gl_FUNC_ILOGBL],
 ])
 
 dnl Test whether ilogbl() works.
-dnl On Cygwin 2.9, ilogb(0.0L) is wrong.
+dnl On Cygwin 2.9, ilogbl(0.0L) is wrong.
+dnl On AIX 7.1 in 64-bit mode, ilogbl(2^(LDBL_MIN_EXP-1)) is wrong.
 dnl On Haiku 2017, it returns i-2 instead of i-1 for values between
 dnl ca. 2^-16444 and ca. 2^-16382.
 AC_DEFUN([gl_FUNC_ILOGBL_WORKS],
@@ -115,13 +116,22 @@ int main (int argc, char *argv[])
     if (my_ilogbl (x) != FP_ILOGB0)
       result |= 1;
   }
+  /* This test fails on AIX 7.1 in 64-bit mode.  */
+  {
+    int i;
+    x = 0.5L;
+    for (i = LDBL_MIN_EXP - 1; i < 0; i++)
+      x = x * 0.5L;
+    if (x > 0.0L && my_ilogbl (x) != LDBL_MIN_EXP - 2)
+      result |= 2;
+  }
   /* This test fails on Haiku 2017.  */
   {
     int i;
     for (i = 1, x = (long double)1.0; i >= LDBL_MIN_EXP-100 && x > (long double)0.0; i--, x *= (long double)0.5)
       if (my_ilogbl (x) != i - 1)
         {
-          result |= 2;
+          result |= 4;
           break;
         }
   }
@@ -131,7 +141,8 @@ int main (int argc, char *argv[])
         [gl_cv_func_ilogbl_works=yes],
         [gl_cv_func_ilogbl_works=no],
         [case "$host_os" in
-           haiku*) gl_cv_func_ilogbl_works="guessing no" ;;
+           aix* | haiku*)
+                   gl_cv_func_ilogbl_works="guessing no" ;;
                    # Guess yes on native Windows.
            mingw*) gl_cv_func_ilogbl_works="guessing yes" ;;
            *)      gl_cv_func_ilogbl_works="guessing yes" ;;
-- 
2.7.4


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2021-01-06 10:14 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-06 10:14 ilogb, ilogbl: Fix test failures on AIX 7.1 in 64-bit mode Bruno Haible

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).