#include #include #include #include jmp_buf jmp; static void handle_error(int unused) { (void)unused; longjmp(jmp, 1); } __attribute__((optimize("O0"))) int main() { uint64_t ptr; size_t i; signal(SIGSEGV, handle_error); for (i = 0; i < 1000; ++i) { if (setjmp(jmp) == 0) { ptr = arc4random() + ((uint64_t) arc4random() << 32); printf("%p\n", (void *)ptr); *(unsigned *)ptr = 0xdeadbeef; } } return 0; }