From 5f03033b0e211f9ed13e7a1351f9a8f9011ab665 Mon Sep 17 00:00:00 2001 From: Berke Güzel Date: Thu, 15 Oct 2026 12:04:04 +0300 Subject: Fix snapshot failure test under LTO --- tests/snapshot_failure_test.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tests/snapshot_failure_test.c b/tests/snapshot_failure_test.c index 4133bfd..a516ec2 100644 --- a/tests/snapshot_failure_test.c +++ b/tests/snapshot_failure_test.c @@ -5,9 +5,11 @@ #include #include -static bool fail_next_realloc; -static int malloc_failure_countdown = -1; -static bool malloc_was_failed; +/* --wrap redirects calls after LTO has analyzed their side effects. Keep + * these accesses observable so it cannot fold away the wrapper's changes. */ +static volatile bool fail_next_realloc; +static volatile int malloc_failure_countdown = -1; +static volatile bool malloc_was_failed; void *__real_malloc(size_t); void *__wrap_malloc(size_t size) { -- cgit v1.2.3