On AIX 7.1 and 7.3.1, I see this test failure:

  FAIL: test-realloc-posix
  ========================

  ../../gltests/test-realloc-posix.c:34: assertion 'p != NULL' failed
  FAIL test-realloc-posix (exit status: 134)

The cause is my change from 2024-10-27:
<https://lists.gnu.org/archive/html/bug-gnulib/2024-10/msg00238.html>
where I moved the unit test, but without ensuring that the realloc()
function actually satisfies this unit test.

Paul's change from 2024-10-30
<https://lists.gnu.org/archive/html/bug-gnulib/2024-10/msg00252.html>
then was half of what's needed to make the 'realloc-posix' module
behave like we want.

Here's the second half of the fix:


2024-11-01  Bruno Haible  <br...@clisp.org>

        realloc-posix: Fix test failure on AIX (regression 2024-10-27).
        * m4/realloc.m4 (gl_FUNC_REALLOC_0_NONNULL): New macro.
        * modules/realloc-posix (configure.ac): Invoke it.

diff --git a/m4/realloc.m4 b/m4/realloc.m4
index 4f414b4817..639d7a9efe 100644
--- a/m4/realloc.m4
+++ b/m4/realloc.m4
@@ -1,5 +1,5 @@
 # realloc.m4
-# serial 36
+# serial 37
 dnl Copyright (C) 2007, 2009-2024 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -75,3 +75,14 @@ AC_DEFUN([gl_FUNC_REALLOC_POSIX]
     fi
   fi
 ])
+
+# gl_FUNC_REALLOC_0_NONNULL
+# -------------------------
+# Replace realloc if it is not compatible with GNU libc.
+AC_DEFUN([gl_FUNC_REALLOC_0_NONNULL],
+[
+  AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
+
+  _AC_FUNC_REALLOC_IF([], [REPLACE_REALLOC_FOR_REALLOC_POSIX=1],
+    ["$gl_cross_guess_normal"])
+])
diff --git a/modules/realloc-posix b/modules/realloc-posix
index 566d389194..e7188b5f04 100644
--- a/modules/realloc-posix
+++ b/modules/realloc-posix
@@ -12,6 +12,7 @@ stdlib
 
 configure.ac:
 gl_FUNC_REALLOC_POSIX
+gl_FUNC_REALLOC_0_NONNULL
 if test $REPLACE_REALLOC_FOR_REALLOC_POSIX = 1; then
   AC_LIBOBJ([realloc])
 fi




Reply via email to