]> Savannah Git Hosting - gnulib.git/commitdiff
realloc-gnu: Fix wrong configure test result with optimizing ibm-clang.
authorBruno Haible <bruno@clisp.org>
Fri, 17 Nov 2023 23:18:37 +0000 (00:18 +0100)
committerBruno Haible <bruno@clisp.org>
Fri, 24 Nov 2023 07:19:00 +0000 (08:19 +0100)
* m4/realloc.m4 (_AC_FUNC_REALLOC_IF): Use 'volatile', to defeat an
ibm-clang optimization.
* m4/malloc.m4 (_AC_FUNC_MALLOC_IF): Likewise.

ChangeLog
m4/malloc.m4
m4/realloc.m4

index 39d214759dd075d8bf89aa68f5ae9ecf93d7839a..26b03e8e53ba09c16ee82c2a5a33904635eefa5a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2023-11-17  Bruno Haible  <bruno@clisp.org>
+
+       realloc-gnu: Fix wrong configure test result with optimizing ibm-clang.
+       * m4/realloc.m4 (_AC_FUNC_REALLOC_IF): Use 'volatile', to defeat an
+       ibm-clang optimization.
+       * m4/malloc.m4 (_AC_FUNC_MALLOC_IF): Likewise.
+
 2023-11-17  Bruno Haible  <bruno@clisp.org>
 
        gettext: Recognize a statically built libintl on macOS and AIX.
index bc580176f5f010ccf1b210a021fb01d35a25d52b..8ae6c415bec3540aa8450c63570757af206d93af 100644 (file)
@@ -1,4 +1,4 @@
-# malloc.m4 serial 29
+# malloc.m4 serial 29.1
 dnl Copyright (C) 2007, 2009-2023 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -16,7 +16,8 @@ AC_DEFUN([_AC_FUNC_MALLOC_IF],
           [[#include <stdlib.h>
           ]],
           [[void *p = malloc (0);
-            int result = !p;
+            void * volatile vp = p;
+            int result = !vp;
             free (p);
             return result;]])
        ],
index 26053914cbe84355b357b2bd4c376e12e71d9214..cf9470d2ec0be1ac635d0ea0ae2931ced37453e6 100644 (file)
@@ -1,4 +1,4 @@
-# realloc.m4 serial 27
+# realloc.m4 serial 27.1
 dnl Copyright (C) 2007, 2009-2023 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -16,7 +16,8 @@ AC_DEFUN([_AC_FUNC_REALLOC_IF],
           [[#include <stdlib.h>
           ]],
           [[void *p = realloc (0, 0);
-            int result = !p;
+            void * volatile vp = p;
+            int result = !vp;
             free (p);
             return result;]])
        ],