111
|
1 /* { dg-do run } */
|
|
2 /* { dg-skip-if "Stack alignment is too small" { hppa*-*-hpux* } } */
|
131
|
3 /* { dg-require-effective-target alloca } */
|
111
|
4
|
|
5 #include "check.h"
|
|
6
|
|
7 #ifndef ALIGNMENT
|
|
8 #define ALIGNMENT 64
|
|
9 #endif
|
|
10
|
|
11 typedef int aligned __attribute__((aligned(ALIGNMENT)));
|
|
12
|
|
13 int global;
|
|
14
|
|
15 void
|
|
16 bar (char *p, int size)
|
|
17 {
|
|
18 __builtin_strncpy (p, "good", size);
|
|
19 }
|
|
20
|
|
21 class Base {};
|
|
22
|
|
23 struct A : virtual public Base
|
|
24 {
|
|
25 A() {}
|
|
26 };
|
|
27
|
|
28 struct B {};
|
|
29
|
|
30 void
|
|
31 foo (int size)
|
|
32 #if __cplusplus <= 201402L
|
|
33 throw (B,A) // { dg-warning "deprecated" "" { target { c++11 && { ! c++17 } } } }
|
|
34 #endif
|
|
35 {
|
|
36 char *p = (char*) __builtin_alloca (size + 1);
|
|
37 aligned i;
|
|
38
|
|
39 bar (p, size);
|
|
40 if (__builtin_strncmp (p, "good", size) != 0)
|
|
41 {
|
|
42 #ifdef DEBUG
|
|
43 p[size] = '\0';
|
|
44 printf ("Failed: %s != good\n", p);
|
|
45 #endif
|
|
46 abort ();
|
|
47 }
|
|
48
|
|
49 if (check_int (&i, __alignof__(i)) != i)
|
|
50 abort ();
|
|
51
|
|
52 throw A();
|
|
53 }
|
|
54
|
|
55 int
|
|
56 main()
|
|
57 {
|
|
58 try { foo (5); }
|
|
59 catch (A& a) { }
|
|
60 return 0;
|
|
61 }
|