]> Savannah Git Hosting - gnulib.git/commitdiff
calloc-gnu: Avoid wrong configure results with clang.
authorBruno Haible <bruno@clisp.org>
Sat, 23 May 2020 18:41:51 +0000 (20:41 +0200)
committerBruno Haible <bruno@clisp.org>
Sat, 23 May 2020 18:41:51 +0000 (20:41 +0200)
* m4/calloc.m4 (_AC_FUNC_CALLOC_IF): Mark the pointer variable as
'volatile', to defeat compiler optimizations.

ChangeLog
m4/calloc.m4

index af8062c562070e37f7289189ac17d8b1d09272e7..e5a1f13f458c3a9c860d21d7d5748048a95bdebf 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2020-05-23  Bruno Haible  <bruno@clisp.org>
+
+       calloc-gnu: Avoid wrong configure results with clang.
+       * m4/calloc.m4 (_AC_FUNC_CALLOC_IF): Mark the pointer variable as
+       'volatile', to defeat compiler optimizations.
+
 2020-05-23  Bruno Haible  <bruno@clisp.org>
 
        isnanl, isnanl-nolibm: Make a test work better with "gcc -O2" on x86_64.
index 2e0d8ff03a520b75347c5ba8cbb8db648a285e06..3361cba7a6086d3a53f1adbd61351ecd0a430619 100644 (file)
@@ -1,4 +1,4 @@
-# calloc.m4 serial 20
+# calloc.m4 serial 21
 
 # Copyright (C) 2004-2020 Free Software Foundation, Inc.
 # This file is free software; the Free Software Foundation
@@ -25,7 +25,7 @@ AC_DEFUN([_AC_FUNC_CALLOC_IF],
        [AC_LANG_PROGRAM(
           [AC_INCLUDES_DEFAULT],
           [[int result = 0;
-            char *p = calloc (0, 0);
+            char * volatile p = calloc (0, 0);
             if (!p)
               result |= 1;
             free (p);