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