PR testsuite/52641
[official-gcc.git] / gcc / testsuite / gcc.dg / tree-ssa / ssa-ccp-17.c
blob338d8a862979b861a2465734e5a49fdd17111f23
1 /* { dg-do compile } */
2 /* { dg-options "-O -fdump-tree-ccp1" } */
4 int foo(void)
6 int i = 0;
7 char *p = (char *)&i;
8 return *(int *)p;
11 struct Foo {
12 int i;
13 } f;
15 int bar(void)
17 char *p = (char *)&f;
18 return ((struct Foo *)p)->i;
21 extern const struct Foo g;
23 int foobar(void)
25 struct Foo *p = (struct Foo *)&g;
26 return ((const struct Foo *)p)->i;
29 /* { dg-final { scan-tree-dump "= i_.;" "ccp1" } } */
30 /* { dg-final { scan-tree-dump "= f.i;" "ccp1" } } */
31 /* { dg-final { scan-tree-dump "= g.i;" "ccp1" } } */
32 /* { dg-final { cleanup-tree-dump "ccp1" } } */