* doc/invoke.texi: Document -std=c++17 and -std=gnu++17 and document
[official-gcc.git] / gcc / testsuite / g++.dg / torture / stackalign / eh-alloca-1.C
blob02693c04d4b94e6a436d16f8a0f200ef238528d3
1 /* { dg-do run } */
2 /* { dg-skip-if "Stack alignment is too small" { hppa*-*-hpux* } } */
4 #include "check.h"
6 #ifndef ALIGNMENT
7 #define ALIGNMENT       64
8 #endif
10 typedef int aligned __attribute__((aligned(ALIGNMENT)));
12 int global;
14 void
15 bar (char *p, int size)
17   __builtin_strncpy (p, "good", size);
20 class Base {};
22 struct A : virtual public Base
24   A() {}
27 struct B {};
29 void
30 foo (int size)
31 #if __cplusplus <= 201402L
32 throw (B,A)                     // { dg-warning "deprecated" "" { target { c++11 && { ! c++17 } } } }
33 #endif
35   char *p = (char*) __builtin_alloca (size + 1);
36   aligned i;
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     }
48   if (check_int (&i,  __alignof__(i)) != i)
49     abort ();
51   throw A();
54 int
55 main()
57   try { foo (5); }
58   catch (A& a) { }
59   return 0;