Debian Codegraph @

gcc/testsuite/gcc.dg/pr108117.c

raw
1 /* { dg-do run } */
2 /* { dg-require-effective-target nonlocal_goto } */
3 /* { dg-require-effective-target scheduling } */
4 /* { dg-options "-O2 -fschedule-insns" } */
5
6 #include <stdio.h>
7 #include <setjmp.h>
8
9 jmp_buf ex_buf;
10
11 __attribute__((noipa))
12 void fn_throw(int x)
13 {
14 if (x)
15 longjmp(ex_buf, 1);
16 }
17
18 int main(void)
19 {
20 int vb = 0; // NB: not volatile, not modified after setjmp
21
22 if (!setjmp(ex_buf)) {
23 fn_throw(1);
24 vb = 1; // not reached in the abstract machine
25 }
26
27 if (vb) {
28 printf("Failed, vb = %d!\n", vb);
29 return 1;
30 }
31 }