diff --git a/Source/kwsys/testProcess.c b/Source/kwsys/testProcess.c index 0060c4d1f..60449175b 100644 --- a/Source/kwsys/testProcess.c +++ b/Source/kwsys/testProcess.c @@ -94,7 +94,12 @@ int test4(int argc, const char* argv[]) fprintf(stderr, "Output before crash on stderr from crash test.\n"); fflush(stdout); fflush(stderr); +#if defined(__APPLE__) && defined(__x86_64__) && defined(__OPTIMIZE__) \ + && defined(__clang__) + *(int*)1 = 0; /* Clang's optimizer produces bad code for 0-ptr. */ +#else *(int*)0 = 0; +#endif fprintf(stdout, "Output after crash on stdout from crash test.\n"); fprintf(stderr, "Output after crash on stderr from crash test.\n"); return 0;