OSDN Git Service

PR tree-optimization/51799
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.dg / tree-ssa / forwprop-12.c
1 /* { dg-do compile } */
2 /* { dg-options "-O -fdump-tree-forwprop1" } */
3
4 struct X { int a[256]; };
5
6 int foo(struct X *p, __SIZE_TYPE__ i)
7 {
8   int *q = &p->a[0];
9   int *q2 = (int *)((void *)q + i*4 + 32);
10   return *q2;
11 }
12
13 int bar(struct X *p, int i)
14 {
15   return *((int *)p + i + 8);
16 }
17
18 /* We should have propagated the base array address through the
19    address arithmetic into the memory access as an array access.  */
20
21 /* { dg-final { scan-tree-dump-times "->a\\\[D\\\." 2 "forwprop1" { xfail *-*-* } } } */
22 /* { dg-final { cleanup-tree-dump "forwprop1" } } */