From 993ca832d232c33da1d2bb07e91acd6d301ebea0 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Wed, 9 Jun 2021 21:34:22 +0200 Subject: [PATCH] sigsegv tests: Hide a null pointer from the compiler's optimizations. Patch by Paul Eggert. * tests/test-sigsegv-catch-stackoverflow2.c (null_pointer_to_volatile_int): New variable. (main): Use it. --- ChangeLog | 8 ++++++++ tests/test-sigsegv-catch-stackoverflow2.c | 3 ++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index fd067c3f26..0ae76be1e7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2021-06-09 Bruno Haible + + sigsegv tests: Hide a null pointer from the compiler's optimizations. + Patch by Paul Eggert. + * tests/test-sigsegv-catch-stackoverflow2.c + (null_pointer_to_volatile_int): New variable. + (main): Use it. + 2021-06-07 Bruno Haible get_ppid_of: Add support for DragonFly BSD. diff --git a/tests/test-sigsegv-catch-stackoverflow2.c b/tests/test-sigsegv-catch-stackoverflow2.c index b94d1310b3..a491fd272f 100644 --- a/tests/test-sigsegv-catch-stackoverflow2.c +++ b/tests/test-sigsegv-catch-stackoverflow2.c @@ -50,6 +50,7 @@ sigset_t mainsigset; volatile int pass = 0; uintptr_t page; +volatile int *null_pointer_to_volatile_int /* = NULL */; static void stackoverflow_handler_continuation (void *arg1, void *arg2, void *arg3) @@ -183,7 +184,7 @@ main () *(volatile int *) (page + 0x678) = 42; break; case 3: - *(volatile int *) 0 = 42; + *null_pointer_to_volatile_int = 42; break; case 4: break; -- 2.39.5