summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/tree-ssa/pr21658.c
blob: 577e1795e74c045e3ce9bb7e93143f70cd8f7d6d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/* PR tree-optimization/21658
   CCP did not propagate an ADDR_EXPR far enough, preventing the "if"
   statement below from being folded.  */

/* { dg-do compile } */
/* { dg-options "-O2 -fno-tree-dominator-opts -fdump-tree-ccp-details" } */

void link_error (void);

void
f (void)
{
  int a[10];
  int *p = &a[5];
  int *q = p - 1;
  if (q != &a[4])
    link_error ();
}

/* { dg-final { scan-tree-dump-times "Folded statement: if " 1 "ccp1"} } */
/* { dg-final { cleanup-tree-dump "ccp\[1-2\]" } } */