From: Bruno Haible Date: Wed, 9 Jun 2021 19:34:22 +0000 (+0200) Subject: sigsegv tests: Hide a null pointer from the compiler's optimizations. X-Git-Tag: v1.0~2834 X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=993ca832d232c33da1d2bb07e91acd6d301ebea0;p=gnulib.git 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. --- 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;