PR target/55146
[official-gcc.git] / gcc / testsuite / gcc.dg / pr50527.c
blob824c3fc6037f98afe7316dcd7c6f274426f7123a
1 /* { dg-do run } */
2 /* { dg-options "-Os --param large-stack-frame=30 -Wno-pointer-to-int-cast" } */
4 extern void abort (void);
6 void __attribute__((noinline))
7 bar (char *a)
11 void __attribute__((noinline))
12 foo (char *a, int b)
16 void __attribute__((noinline))
17 test_align (char *p, int aligned, unsigned int mask)
19 int p_aligned = ((unsigned long int)p & mask) == 0;
20 if (aligned != p_aligned)
21 abort ();
24 int
25 main ()
27 const int kIterations = 4;
28 char results[kIterations];
29 int i;
30 unsigned int mask;
32 mask = 0xf;
33 test_align (results, ((unsigned long int)results & mask) == 0, mask);
34 mask = 0x7;
35 test_align (results, ((unsigned long int)results & mask) == 0, mask);
36 mask = 0x3;
37 test_align (results, ((unsigned long int)results & mask) == 0, mask);
38 mask = 0x1;
39 test_align (results, ((unsigned long int)results & mask) == 0, mask);
41 bar (results);
42 for (i = 0; i < kIterations; i++)
43 foo ("%d ", results[i]);
45 return 0;