diff --git a/testProcess.c b/testProcess.c
index 877002a1452c1bfbeaaf9d78e5d87a9da67ed4a4..ec561ead7cef3ccce24b4e0fb975323013d8b0c6 100644
--- a/testProcess.c
+++ b/testProcess.c
@@ -82,6 +82,14 @@ int test3(int argc, const char* argv[])
 
 int test4(int argc, const char* argv[])
 {
+  /* Prepare a pointer to an invalid address.  Don't use null, because
+  dereferencing null is undefined behaviour and compilers are free to
+  do whatever they want. ex: Clang will warn at compile time, or even
+  optimize away the write. We hope to 'outsmart' them by using
+  'volatile' and a slightly larger address, based on a runtime value. */
+  volatile int* invalidAddress = 0;
+  invalidAddress += argc?1:2;
+
 #if defined(_WIN32)
   /* Avoid error diagnostic popups since we are crashing on purpose.  */
   SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX);
@@ -94,11 +102,8 @@ int test4(int argc, const char* argv[])
   fprintf(stderr, "Output before crash on stderr from crash test.\n");  
   fflush(stdout);
   fflush(stderr);
-#if defined(__clang__)
-  *(int*)1 = 0; /* Clang warns about 0-ptr; undefined behavior.  */
-#else
-  *(int*)0 = 0;
-#endif
+  /* Provoke deliberate crash by writing to the invalid address. */
+  *invalidAddress = 0;
   fprintf(stdout, "Output after crash on stdout from crash test.\n");
   fprintf(stderr, "Output after crash on stderr from crash test.\n");
   return 0;