Debian Codegraph @

gcc/testsuite/g++.dg/eh/gcsec1.C

raw
1 /* PR other/29639 */
2 /* AIX gld supports garbage collection. But AIX gcc does not support
3 -ffunction-sections or -fdata-sections. */
4 /* { dg-do run { xfail rs6000-*-aix* powerpc*-*-aix* } } */
5 /* { dg-require-gc-sections "" } */
6 /* { dg-options "-ffunction-sections -Wl,--gc-sections" } */
7
8 extern "C" void abort (void);
9
10 int g = 0;
11
12 void raise_exception()
13 {
14 throw 1;
15 }
16
17 void used()
18 {
19 try {
20 raise_exception ();
21 }
22 catch (int) {
23 g = 1;
24 }
25 }
26
27 void unused()
28 {
29 try {
30 raise_exception ();
31 }
32 catch (int) {
33 g = 1;
34 }
35 }
36
37 int main()
38 {
39 used ();
40
41 if (g != 1)
42 abort ();
43
44 return 0;
45 }