OSDN Git Service

2010-01-21 Martin Jambor <mjambor@suse.cz>
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.dg / tree-ssa / ssa-ccp-17.c
1 /* { dg-do compile } */
2 /* { dg-options "-O -fdump-tree-ccp1" } */
3
4 int foo(void)
5 {
6   int i = 0;
7   char *p = (char *)&i;
8   return *(int *)p;
9 }
10
11 struct Foo {
12   int i;
13 } f;
14
15 int bar(void)
16 {
17   char *p = (char *)&f;
18   return ((struct Foo *)p)->i;
19 }
20
21 const struct Foo g;
22
23 int foobar(void)
24 {
25   struct Foo *p = (struct Foo *)&g;
26   return ((const struct Foo *)p)->i;
27 }
28
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" } } */