From: Bruno Haible Date: Fri, 17 Nov 2023 23:18:37 +0000 (+0100) Subject: realloc-gnu: Fix wrong configure test result with optimizing ibm-clang. X-Git-Tag: v1.0~582 X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=3a76977fd70b64e3c90139ebfae385e4370e70e1;p=gnulib.git 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. --- diff --git a/ChangeLog b/ChangeLog index 807b2d6e7d..d2ac6eb7f4 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 mbrtowc, mbrtoc32, nl_langinfo, setlocale-null: Obey --disable-threads. diff --git a/m4/malloc.m4 b/m4/malloc.m4 index 096c262b17..8b8c56eef5 100644 --- a/m4/malloc.m4 +++ b/m4/malloc.m4 @@ -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 ]], [[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 fcd6253557..9911866f58 100644 --- a/m4/realloc.m4 +++ b/m4/realloc.m4 @@ -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 ]], [[void *p = realloc (0, 0); - int result = !p; + void * volatile vp = p; + int result = !vp; free (p); return result;]]) ],