Debian Codegraph @

gcc/testsuite/gcc.dg/torture/stackalign/inline-2.c

raw
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 static void
21 inline __attribute__((always_inline))
22 foo (int size)
23 {
24 char *p = __builtin_alloca (size + 1);
25 aligned i;
26
27 bar (p, size);
28 if (__builtin_strncmp (p, "good", size) != 0)
29 {
30 #ifdef DEBUG
31 p[size] = '\0';
32 printf ("Failed: %s != good\n", p);
33 #endif
34 abort ();
35 }
36
37 if (check_int (&i, __alignof__(i)) != i)
38 abort ();
39 }
40
41 int
42 main()
43 {
44 foo (5);
45 return 0;
46 }