PR middle-end/77357 - strlen of constant strings not folded
[official-gcc.git] / gcc / testsuite / gcc.dg / ipa / propalign-2.c
blob51799c7fbd10bddb9d851c6d05a7c986ef33ff72
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 } } } */
5 #include <stdint.h>
7 extern int fail_the_test(void *);
8 extern int pass_the_test(void *);
9 extern int diversion (void *);
11 struct somestruct
13 void *whee;
14 void *oops;
17 struct container
19 struct somestruct first;
20 struct somestruct buf[32];
23 static int __attribute__((noinline))
24 foo (void *p)
26 uintptr_t a = (uintptr_t) p;
28 if (a % 4)
29 return fail_the_test (p);
30 else
31 return pass_the_test (p);
34 int
35 bar (void)
37 struct container c;
38 return foo (c.buf);
42 static int
43 through (struct somestruct *p)
45 diversion (p);
46 return foo (&p[16]);
49 int
50 bar2 (void)
52 struct container c;
53 through (c.buf);
56 /* { dg-final { scan-ipa-dump "Adjusting align" "cp" } } */
57 /* { dg-final { scan-tree-dump-not "fail_the_test" "optimized" } } */