Debian Codegraph @

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

raw
1 /* Test AAPCS layout (alignment) for callee. */
2
3 /* { dg-do run { target arm_eabi } } */
4 /* { dg-require-effective-target arm32 } */
5 /* { dg-options "-O2 -fno-inline" } */
6
7 extern int memcmp (const void *s1, const void *s2, __SIZE_TYPE__ n);
8 extern void abort (void);
9
10 typedef struct __attribute__((aligned (8)))
11 {
12 int x;
13 int y;
14 } overaligned;
15
16 overaligned a = { 2, 3 };
17 overaligned b = { 5, 8 };
18
19 void
20 f (int r0, overaligned r1, int r3, int stack, overaligned stack4)
21 {
22 if (r0 != 7 || r3 != 9 || stack != 10)
23 abort ();
24 if (memcmp ((void *) &r1, (void *)&a, sizeof (overaligned)))
25 abort ();
26 if (memcmp ((void *)&stack4, (void *)&b, sizeof (overaligned)))
27 abort ();
28 int addr = ((int) &stack4) & 7;
29 if (addr != 0)
30 {
31 __builtin_printf ("Alignment was %d\n", addr);
32 abort ();
33 }
34 }
35
36 int
37 main (int argc, char **argv)
38 {
39 f (7, a, 9, 10, b);
40 return 0;
41 }