xref: /kvm-unit-tests/x86/setjmp.c (revision 9dde4243e6f1759280d3fed2486ae62e80c3f8c7)
1 #include "stdio.h"
2 #include "setjmp.h"
3 
4 int main()
5 {
6     volatile int i;
7     jmp_buf j;
8 
9     if (setjmp(j) == 0) {
10 	    i = 0;
11     }
12     printf("%d\n", i);
13     if (++i < 10) {
14 	    longjmp(j, 1);
15     }
16 
17     printf("done\n");
18     return 0;
19 }
20