Debian Codegraph @

gcc/testsuite/gcc.target/arm/aapcs/align_vaarg2.c

raw
1 /* Test AAPCS layout (alignment of varargs) for callee. */
2
3 /* { dg-do run { target arm_eabi } } */
4 /* { dg-require-effective-target arm32 } */
5 /* { dg-options "-O2 -fno-inline" } */
6
7 #include <stdarg.h>
8
9 extern void abort (void);
10
11 typedef __attribute__((aligned (8))) int alignedint;
12
13 void
14 foo (int i, ...)
15 {
16 va_list va;
17 va_start (va, i);
18 /* alignedint should be pulled out of regs/stack just like an int. */
19 while (i-- > 0)
20 if (va_arg (va, alignedint) != i)
21 abort ();
22 va_end (va);
23 }
24
25 int
26 main (int argc, char **argv)
27 {
28 foo (5, 4, 3, 2, 1, 0);
29 return 0;
30 }