From 2e41bb9fe8e84e57a1c175c94fe34ef3ec14dcaa Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Sat, 18 Nov 2023 00:18:37 +0100 Subject: [PATCH] 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. --- ChangeLog | 7 +++++++ m4/malloc.m4 | 5 +++-- m4/realloc.m4 | 5 +++-- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7d8b33d483..3836b0dab2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2023-11-17 Bruno Haible + + 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 striconveha: pacify gcc -Wcast-align diff --git a/m4/malloc.m4 b/m4/malloc.m4 index 554029243d..7c36445cb2 100644 --- a/m4/malloc.m4 +++ b/m4/malloc.m4 @@ -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 ]], [[void *p = malloc (0); - int result = !p; + void * volatile vp = p; + int result = !vp; free (p); return result;]]) ], diff --git a/m4/realloc.m4 b/m4/realloc.m4 index d22138fc7a..fbb904ff9e 100644 --- a/m4/realloc.m4 +++ b/m4/realloc.m4 @@ -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 ]], [[void *p = realloc (0, 0); - int result = !p; + void * volatile vp = p; + int result = !vp; free (p); return result;]]) ], -- 2.39.5