http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59083
--- Comment #7 from Markus Trippelsdorf <octoploid at yandex dot com> --- markus@x4 tmp % cat test.c #include <setjmp.h> #include <signal.h> #include <stdio.h> #include <stdlib.h> #include <sys/types.h> static sigjmp_buf jmpbuf; static void sig_handler (int signo) { siglongjmp (jmpbuf, 1); } int main (void) { char *p = NULL; volatile int ret = 0; struct sigaction sa; sa.sa_handler = sig_handler; sigemptyset (&sa.sa_mask); sa.sa_flags = SA_SIGINFO; if (sigaction (SIGSEGV, &sa, 0)) { perror ("installing SIGSEGV handler\n"); exit (1); } puts ("Attempting to sprintf to null ptr"); if (setjmp (jmpbuf)) { puts ("Exiting main..."); return ret; } sprintf (p, "This should segv\n"); return 1; } markus@x4 tmp % gcc -O2 test.c && ./a.out Attempting to sprintf to null ptr [1] 28519 illegal hardware instruction ./a.out markus@x4 tmp % gcc -fno-isolate-erroneous-paths -O2 test.c && ./a.out Attempting to sprintf to null ptr Exiting main... markus@x4 tmp %