aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gcc.dg/tree-ssa/pr21658.c
blob: c1a48c04b96a5ba03036d2bb72ffcf8aae9cb22c (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-ccp1-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 into: if " 1 "ccp1"} } */
/* { dg-final { cleanup-tree-dump "ccp1" } } */