Merge from trunk @ 138209
[official-gcc.git] / gcc / testsuite / g++.dg / eh / async-unwind1.C
blob69b2c345e751bbefb603220ae6c88bd453f9cc45
1 // PR rtl-optimization/36419
2 // { dg-do run { target { { i?86-*-* x86_64-*-* } && ilp32 } } }
3 // { dg-options "-Os -fasynchronous-unwind-tables -mpreferred-stack-boundary=4" }
5 extern "C" void abort ();
7 int v = -1;
8 unsigned int n;
10 __attribute__((noinline, used))
11 void foo (int a, int)
13   if (v < 0)
14     v = ((unsigned long) &a) & 15;
15   else if ((((unsigned long) &a) & 15) != v)
16     abort ();
17   if (n++ == 0)
18     throw 1;
21 __attribute__((noinline, used))
22 void baz (int a, int, int, int, int, int, int)
24   if (v < 0)
25     v = ((unsigned long) &a) & 15;
26   else if ((((unsigned long) &a) & 15) != v)
27     abort ();
28   if (n++ == 0)
29     throw 1;
32 struct A { A () { }; ~A (); char c[24]; };
34 __attribute__((noinline))
35 A::~A ()
37   asm volatile ("" : : : "memory");
40 __attribute__((noinline))
41 void bar ()
43   A a;
44   try
45     {
46       foo (1, 2);
47       baz (3, 4, 5, 6, 7, 8, 9);
48     }
49   catch (...)
50     {
51     }
52   foo (1, 2);
53   baz (3, 4, 5, 6, 7, 8, 9);
56 int
57 main ()
59   bar ();
60   return 0;