Debian Codegraph @

gcc/testsuite/g++.dg/torture/pr100382.C

raw
1 // { dg-do run }
2 // { dg-additional-options -fno-delete-dead-exceptions }
3
4 int x, y;
5 int __attribute__((pure,noinline)) foo () { if (x) throw 1; return y; }
6
7 int __attribute__((noinline)) bar()
8 {
9 int a[2];
10 x = 1;
11 try {
12 int res = foo ();
13 a[0] = res;
14 } catch (...) {
15 return 0;
16 }
17 return 1;
18 }
19
20 int main()
21 {
22 if (bar ())
23 __builtin_abort ();
24 return 0;
25 }