From 46026ed759e96d6c1a170914ba0aacac28e69b94 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 39d214759d..26b03e8e53 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-17 Bruno Haible gettext: Recognize a statically built libintl on macOS and AIX. diff --git a/m4/malloc.m4 b/m4/malloc.m4 index bc580176f5..8ae6c415be 100644 --- a/m4/malloc.m4 +++ b/m4/malloc.m4 @@ -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 ]], [[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 26053914cb..cf9470d2ec 100644 --- a/m4/realloc.m4 +++ b/m4/realloc.m4 @@ -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 ]], [[void *p = realloc (0, 0); - int result = !p; + void * volatile vp = p; + int result = !vp; free (p); return result;]]) ], -- 2.39.5