1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
/* Test AAPCS layout (alignment) for callee. */
/* { dg-do run { target aarch64*-*-* } } */
extern int memcmp (const void *s1, const void *s2, __SIZE_TYPE__ n);
extern void abort (void);
struct s
{
/* This forces the alignment and size of the struct to 16. */
__attribute__ ((__aligned__ (16))) long x;
int y;
/* 4 bytes padding. */
};
typedef struct s __attribute__ ((__aligned__ (8))) underaligned;
underaligned a = { 1, 4 };
underaligned b = { 9, 16 };
underaligned c = { 25, 36 };
void
test_underaligned_struct (int x0, underaligned x2, int x4, underaligned x6,
int stack, underaligned stack16)
{
if (x0 != 3 || x4 != 5 || stack != 7)
abort ();
if (memcmp ((void *) &x2, (void *)&a, sizeof (underaligned)))
abort ();
if (memcmp ((void *)&x6, (void *)&b, sizeof (underaligned)))
abort ();
if (memcmp ((void *)&stack16, (void *)&c, sizeof (underaligned)))
abort ();
}
int
main (int argc, char **argv)
{
test_underaligned_struct (3, a, 5, b, 7, c);
return 0;
}
|