Debian Codegraph @

gcc/testsuite/gcc.target/arm/aapcs/align_vaarg1.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 /* Arguments should be passed in the same registers as if they were ints. */
19 while (i-- > 0)
20 if (va_arg (va, int) != i)
21 abort ();
22 va_end (va);
23 }
24
25 int
26 main (int argc, char **argv)
27 {
28 alignedint a = 5;
29 alignedint b = 4;
30 alignedint c = 3;
31 alignedint d = 2;
32 alignedint e = 1;
33 alignedint f = 0;
34 foo (a, b, c, d, e, f);
35 return 0;
36 }