From 5c8290b0e74ec91c06d81d775e60407209fb789b Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Mon, 4 Nov 2024 11:47:23 +0100 Subject: [PATCH] malloc, calloc, realloc tests: Work around clang optimization bug. * tests/test-malloc-posix.c (my_malloc): New variable. * tests/test-calloc-posix.c (my_calloc): New variable. * tests/test-realloc-posix.c (my_realloc): New variable. --- ChangeLog | 7 +++++++ tests/test-calloc-posix.c | 5 +++++ tests/test-malloc-posix.c | 5 +++++ tests/test-realloc-posix.c | 5 +++++ 4 files changed, 22 insertions(+) diff --git a/ChangeLog b/ChangeLog index 1381089ad8..c73909152a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2024-11-04 Bruno Haible + + malloc, calloc, realloc tests: Work around clang optimization bug. + * tests/test-malloc-posix.c (my_malloc): New variable. + * tests/test-calloc-posix.c (my_calloc): New variable. + * tests/test-realloc-posix.c (my_realloc): New variable. + 2024-11-03 Bruno Haible crc: Fix build rules with Automake's option 'subdir-objects'. diff --git a/tests/test-calloc-posix.c b/tests/test-calloc-posix.c index d75a255cf5..5fb5c3baa2 100644 --- a/tests/test-calloc-posix.c +++ b/tests/test-calloc-posix.c @@ -25,6 +25,11 @@ #include "macros.h" +/* Work around clang bug + . */ +void *(* volatile my_calloc) (size_t, size_t) = calloc; +#define calloc my_calloc + int main () { diff --git a/tests/test-malloc-posix.c b/tests/test-malloc-posix.c index 7a89b0ab79..191b9d1048 100644 --- a/tests/test-malloc-posix.c +++ b/tests/test-malloc-posix.c @@ -25,6 +25,11 @@ #include "macros.h" +/* Work around clang bug + . */ +void *(* volatile my_malloc) (size_t) = malloc; +#define malloc my_malloc + int main () { diff --git a/tests/test-realloc-posix.c b/tests/test-realloc-posix.c index 804d8f24e5..c6d62e1d30 100644 --- a/tests/test-realloc-posix.c +++ b/tests/test-realloc-posix.c @@ -24,6 +24,11 @@ #include "macros.h" +/* Work around clang bug + . */ +void *(* volatile my_realloc) (void *, size_t) = realloc; +#define realloc my_realloc + int main (int argc, _GL_UNUSED char **argv) { -- 2.39.5