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