]> 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, 17 Nov 2023 23:18:37 +0000 (00:18 +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 807b2d6e7ddd92089e522bdb69446008b5b0bddd..d2ac6eb7f46ef230675c5ea76c2ee6d81c267f48 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>
 
        mbrtowc, mbrtoc32, nl_langinfo, setlocale-null: Obey --disable-threads.
index 096c262b17ee275aba0cb0b0b8722f84be7f2489..8b8c56eef5e43c75f593eee0d6c6f2f39448fc1b 100644 (file)
@@ -1,4 +1,4 @@
-# malloc.m4 serial 30
+# malloc.m4 serial 31
 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 fcd6253557b550d8549e3ac219ba17e9c378c8a9..9911866f5827f3b533945d7ff3c695f2e324b9b4 100644 (file)
@@ -1,4 +1,4 @@
-# realloc.m4 serial 28
+# realloc.m4 serial 29
 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;]])
        ],