1 #include <setjmp.h> 2 #include <stdio.h> 3 #include <time.h> 4 5 jmp_buf j; 6 do_jump(void)7void do_jump(void) 8 { 9 // We can't let the compiler know this will always happen or it might make 10 // optimizations that break our test. 11 if (!clock()) 12 longjmp(j, 1); // non-local goto 13 } 14 main(void)15int main (void) 16 { 17 if (setjmp(j) == 0) 18 do_jump(); 19 else 20 return 0; // destination of longjmp 21 22 return 1; 23 } 24