OSDN Git Service

PR rtl-optimization/40924
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / g++.dg / torture / stackalign / eh-inline-2.C
1 /* { dg-do run } */
2
3 #include "check.h"
4
5 #ifndef ALIGNMENT
6 #define ALIGNMENT       64
7 #endif
8
9 typedef int aligned __attribute__((aligned(ALIGNMENT)));
10
11 int global;
12
13 void
14 bar (char *p, int size)
15 {
16   __builtin_strncpy (p, "good", size);
17 }
18
19 class Base {};
20
21 struct A : virtual public Base
22 {
23   A() {}
24 };
25
26 struct B {};
27
28 static void
29 inline __attribute__((always_inline))
30 foo (int size) throw (B,A)
31 {
32   char *p = (char *) __builtin_alloca (size + 1);
33   aligned i;
34
35   bar (p, size);
36   if (__builtin_strncmp (p, "good", size) != 0)
37     {
38 #ifdef DEBUG
39       p[size] = '\0';
40       printf ("Failed: %s != good\n", p);
41 #endif
42       abort ();
43     }
44
45   if (check_int (&i,  __alignof__(i)) != i)
46     abort ();
47
48   throw A();
49 }
50
51 int
52 main()
53 {
54   try { foo (5); }
55   catch (A& a) { }
56   return 0;
57 }