summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tests/snapshot_failure_test.c8
1 files 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 <stddef.h>
#include <stdlib.h>
-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)
{