111
|
1 /* { dg-do compile } */
|
|
2 /* { dg-options "-O2 -fno-early-inlining -fdump-ipa-cp -fdump-tree-optimized" } */
|
|
3 /* { dg-skip-if "No alignment restrictions" { { ! natural_alignment_32 } && { ! natural_alignment_64 } } } */
|
|
4
|
|
5 #include <stdint.h>
|
|
6
|
|
7 extern int fail_the_test(void *);
|
|
8 extern int pass_the_test(void *);
|
|
9 extern int diversion (void *);
|
|
10
|
|
11 struct somestruct
|
|
12 {
|
|
13 void *whee;
|
|
14 void *oops;
|
|
15 };
|
|
16
|
|
17 struct container
|
|
18 {
|
|
19 struct somestruct first;
|
|
20 struct somestruct buf[32];
|
|
21 };
|
|
22
|
|
23 static int __attribute__((noinline))
|
|
24 foo (void *p)
|
|
25 {
|
|
26 uintptr_t a = (uintptr_t) p;
|
|
27
|
|
28 if (a % 4)
|
|
29 return fail_the_test (p);
|
|
30 else
|
|
31 return pass_the_test (p);
|
|
32 }
|
|
33
|
|
34 int
|
|
35 bar (void)
|
|
36 {
|
|
37 struct container c;
|
|
38 return foo (c.buf);
|
|
39 }
|
|
40
|
|
41
|
|
42 static int
|
|
43 through (struct somestruct *p)
|
|
44 {
|
|
45 diversion (p);
|
|
46 return foo (&p[16]);
|
|
47 }
|
|
48
|
|
49 int
|
|
50 bar2 (void)
|
|
51 {
|
|
52 struct container c;
|
|
53 through (c.buf);
|
|
54 }
|
|
55
|
|
56 /* { dg-final { scan-ipa-dump "Adjusting align" "cp" } } */
|
|
57 /* { dg-final { scan-tree-dump-not "fail_the_test" "optimized" } } */
|