Debian Codegraph @

gcc/testsuite/g++.dg/ext/label3.C

raw
1 // Bug: we were removing the p = q assignment in dce, and then reinserting
2 // it *after* the try/catch in out-of-ssa. Oops.
3
4 // testcase reduced from libjava/interpret.cc.
5
6 // { dg-do run }
7 // { dg-options "-O2" }
8 // { dg-require-effective-target indirect_jumps }
9
10 extern "C" int printf (const char *, ...);
11
12 bool b;
13
14 int main()
15 {
16 __label__ one, two, done;
17 void *labs[] = { &&one, &&two, &&done };
18 const void **q = (const void **)labs;
19 const void **p = q;
20
21 try
22 {
23 one:
24 printf ("one!\n");
25 if (b)
26 throw 42;
27 goto **p++;
28
29 two:
30 printf ("two!\n");
31 goto **p++;
32
33 done:
34 printf ("done!\n");
35 }
36 catch (int)
37 {
38 printf ("caught!\n");
39 }
40 }