GCC 14 on x86-64 with -O2 apparently outsmarts our test for null
pointer dereference, and this is something the C standard allows.
Fix the test by putting ‘volatile’ at the right place.
* tests/test-sigsegv-catch-stackoverflow2.c (null_pointer):
Make it a volatile pointer, not a pointer to volatile.
Also, rename from null_pointer_to_volatile_int; use changed.
---
 ChangeLog                                 | 10 ++++++++++
 tests/test-sigsegv-catch-stackoverflow2.c |  4 ++--
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index e6dffe82e6..65467fbfe5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2024-09-20  Paul Eggert  <egg...@cs.ucla.edu>
+
+       sigsegv-tests: port to GCC 14
+       GCC 14 on x86-64 with -O2 apparently outsmarts our test for null
+       pointer dereference, and this is something the C standard allows.
+       Fix the test by putting ‘volatile’ at the right place.
+       * tests/test-sigsegv-catch-stackoverflow2.c (null_pointer):
+       Make it a volatile pointer, not a pointer to volatile.
+       Also, rename from null_pointer_to_volatile_int; use changed.
+
 2024-09-20  Bruno Haible  <br...@clisp.org>
 
        jit/cache tests: Fix crash with clang's UBSAN + ASAN.
diff --git a/tests/test-sigsegv-catch-stackoverflow2.c 
b/tests/test-sigsegv-catch-stackoverflow2.c
index 60f7eb0cfb..133b616af2 100644
--- a/tests/test-sigsegv-catch-stackoverflow2.c
+++ b/tests/test-sigsegv-catch-stackoverflow2.c
@@ -59,7 +59,7 @@ static sigset_t mainsigset;
 
 static volatile int pass = 0;
 static uintptr_t page;
-static volatile int *null_pointer_to_volatile_int /* = NULL */;
+static int *volatile null_pointer /* = NULL */;
 
 static void
 stackoverflow_handler_continuation (void *arg1, void *arg2, void *arg3)
@@ -193,7 +193,7 @@ main ()
       *(volatile int *) (page + 0x678) = 42;
       break;
     case 3:
-      *null_pointer_to_volatile_int = 42;
+      *null_pointer = 42;
       break;
     case 4:
       break;
-- 
2.46.0


Reply via email to