]> 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:30:41 +0000 (08:30 +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 7d8b33d4833293b22251d9bdd23480a9e8666448..3836b0dab28bfcd51b496ebdd5e766433c4b00d1 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-15  Paul Eggert  <eggert@cs.ucla.edu>
 
        striconveha: pacify gcc -Wcast-align
index 554029243d1e84da84549068bf768eaa6edc54d9..7c36445cb25f89247e2a11b650a1f7ac9e534c0d 100644 (file)
@@ -1,4 +1,4 @@
-# malloc.m4 serial 28
+# malloc.m4 serial 28.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 d22138fc7ac535a4a2d73b5eff75ed6715a2f1b7..fbb904ff9ef2ea8badd4d0bbf3a7bc56b603efc7 100644 (file)
@@ -1,4 +1,4 @@
-# realloc.m4 serial 26
+# realloc.m4 serial 26.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;]])
        ],