summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/tree-ssa/ssa-ccp-16.c
blob: 33f9744d37d1a3885a2e5d14a3038228789c2ba3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
/* { dg-do compile } */
/* { dg-options "-O -fdump-tree-ccp1" } */

static const int x;

int test1 (void)
{
  char *p = "hello";
  int i = x;
  i = i + 5;
  return p[i];
}

int test2 (void)
{
  int i = x;
  i = i + 5;
  return "hello"[i];
}

/* { dg-final { scan-tree-dump-times "return 0;" 2 "ccp1" } } */
/* { dg-final { cleanup-tree-dump "ccp1" } } */