]> Savannah Git Hosting - gnulib.git/commitdiff
sigsegv tests: Hide a null pointer from the compiler's optimizations.
authorBruno Haible <bruno@clisp.org>
Wed, 9 Jun 2021 19:34:22 +0000 (21:34 +0200)
committerBruno Haible <bruno@clisp.org>
Wed, 9 Jun 2021 19:34:22 +0000 (21:34 +0200)
Patch by Paul Eggert.

* tests/test-sigsegv-catch-stackoverflow2.c
(null_pointer_to_volatile_int): New variable.
(main): Use it.

ChangeLog
tests/test-sigsegv-catch-stackoverflow2.c

index fd067c3f26e0d24a408c348012667ccb290f2c44..0ae76be1e7900622fd5f9f41ed2bd4a1d9621404 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2021-06-09  Bruno Haible  <bruno@clisp.org>
+
+       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  <bruno@clisp.org>
 
        get_ppid_of: Add support for DragonFly BSD.
index b94d1310b3c86e0a3d6d101937f8a95c97b8d8ef..a491fd272f5fa44cdccfb113bd18436c183270d9 100644 (file)
@@ -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;