blob: 824c3fc6037f98afe7316dcd7c6f274426f7123a (
plain)
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
42
43
44
45
46
|
/* { dg-do run } */
/* { dg-options "-Os --param large-stack-frame=30 -Wno-pointer-to-int-cast" } */
extern void abort (void);
void __attribute__((noinline))
bar (char *a)
{
}
void __attribute__((noinline))
foo (char *a, int b)
{
}
void __attribute__((noinline))
test_align (char *p, int aligned, unsigned int mask)
{
int p_aligned = ((unsigned long int)p & mask) == 0;
if (aligned != p_aligned)
abort ();
}
int
main ()
{
const int kIterations = 4;
char results[kIterations];
int i;
unsigned int mask;
mask = 0xf;
test_align (results, ((unsigned long int)results & mask) == 0, mask);
mask = 0x7;
test_align (results, ((unsigned long int)results & mask) == 0, mask);
mask = 0x3;
test_align (results, ((unsigned long int)results & mask) == 0, mask);
mask = 0x1;
test_align (results, ((unsigned long int)results & mask) == 0, mask);
bar (results);
for (i = 0; i < kIterations; i++)
foo ("%d ", results[i]);
return 0;
}
|