Remove outermost loop parameter.
[official-gcc/graphite-test-results.git] / gcc / testsuite / g++.dg / torture / stackalign / eh-vararg-1.C
blob74b48faa599383adaede113634fd6483a4049975
1 /* { dg-do run } */
3 #include <stdarg.h>
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 (const char *fmt, ...) throw (B,A)
32   va_list arg;
33   char *p;
34   aligned i;
35   int size;
36   double x;
38   va_start (arg, fmt);
39   size = va_arg (arg, int);
40   if (size != 5)
41     abort ();
42   p = (char *) __builtin_alloca (size + 1);
44   x = va_arg (arg, double);
45   if (x != 5.0)
46     abort ();
48   bar (p, size);
49   if (__builtin_strncmp (p, "good", size) != 0)
50     {
51 #ifdef DEBUG
52       p[size] = '\0';
53       printf ("Failed: %s != good\n", p);
54 #endif
55       abort ();
56     }
58   if (check_int (&i,  __alignof__(i)) != i)
59     abort ();
61   throw A();
63   va_end (arg);
66 int
67 main()
69   try { foo ("foo", 5, 5.0); }
70   catch (A& a) { }
71   return 0;