diff options
| author | Berke Güzel <wenekar1@gmail.com> | 2026-10-15 12:04:04 +0300 |
|---|---|---|
| committer | Berke Güzel <wenekar1@gmail.com> | 2026-10-15 12:04:04 +0300 |
| commit | 5f03033b0e211f9ed13e7a1351f9a8f9011ab665 (patch) | |
| tree | d68c35fb5d61a8b5c3f4ffbf8573102311e68076 | |
| parent | af6a37b1c4509c7766933a7cb45d2ee9a3a23f98 (diff) | |
Fix snapshot failure test under LTO
| -rw-r--r-- | tests/snapshot_failure_test.c | 8 |
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) { |
