aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gcc.dg/tree-ssa/forwprop-11.c
blob: 08d0864af55d200d24be5e6832b0d371d03eb339 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
/* { dg-do compile } */
/* { dg-require-effective-target int32plus } */
/* { dg-options "-O -fdump-tree-forwprop1" } */

int f(int *p, int n)
{
  int (*a)[n] = (int (*)[n])p;
  int *q = &(*a)[0];
  return q[1];
}

int g(int *p, int n)
{
  int (*a)[n] = (int (*)[n])p;
  int *q = &(*a)[2];
  return q[-1];
}

/* { dg-final { scan-tree-dump-times "= MEM\\\[\\\(int \\\*\\\)\[ap\]_.. \\\+ 4B\\\];" 2 "forwprop1" } } */
/* { dg-final { cleanup-tree-dump "forwprop1" } } */