Files
CMake/Tests/RunCMake/exit_crash.c
Brad King 151a7d63dd Tests: Cover execute_process with abnormal exit on all platforms
Use a dedicated helper program instead of a Python script.
This also avoids an interactive popup on macOS.

Fixes: #25973
2024-05-14 09:32:53 -04:00

15 lines
469 B
C

int main(int argc, const char* argv[])
{
#ifndef __clang_analyzer__ /* Suppress clang-analyzer warnings */
/* Construct an invalid address that cannot be predicted by the
compiler/optimizer, and that is not NULL (which is undefined
behavior to dereference). */
volatile int* invalidAddress = 0;
invalidAddress += argc ? 1 : 2;
(void)argv;
/* Write to the invalid address to cause SIGSEGV or similar. */
*invalidAddress = 0;
#endif
return 0;
}