libcpp, c, middle-end: Optimize initializers using #embed in C
[official-gcc.git] / gcc / testsuite / gcc.dg / torture / stackalign / nested-3.c
blob4bebda6e2b93e9d4afe382538bdc953912bc2bca
1 /* { dg-do run } */
2 /* { dg-skip-if "Stack alignment is too small" { hppa*-*-hpux* } } */
3 /* { dg-require-effective-target alloca } */
5 #include "check.h"
7 #ifndef ALIGNMENT
8 #define ALIGNMENT 64
9 #endif
11 typedef int aligned __attribute__((aligned(ALIGNMENT)));
12 extern int strncmp (const char *, const char *, size_t);
14 int global;
16 void
17 copy (char *p, int size)
19 __builtin_strncpy (p, "good", size);
22 void
23 foo (int size)
25 aligned j;
27 __attribute__ ((__noinline__))
28 void bar (int size)
30 char *p = __builtin_alloca (size + 1);
31 aligned i;
33 copy (p, size);
34 if (strncmp (p, "good", size) != 0)
36 #ifdef DEBUG
37 p[size] = '\0';
38 printf ("Failed: %s != good\n", p);
39 #endif
40 abort ();
43 if (check_int (&i, __alignof__(i)) != i)
44 abort ();
46 if (check_int (&j, __alignof__(j)) != j)
47 abort ();
49 j = -20;
51 bar (size);
53 if (j != -20)
54 abort ();
56 if (check_int (&j, __alignof__(j)) != j)
57 abort ();
60 int
61 main()
63 foo (5);
64 return 0;