aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/tree-ssa/pr118902-1.c
blob: fa21b8a74ef821490c0d0564ce9466e8e087a9c4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/* { dg-do compile } */
/* { dg-options "-O2 -fdump-tree-optimized" } */

void foo(int);
void l(int**);
int f1(int j, int t)
{
  int p = 0;
  int *a = &p;
  l(&a);
  if (a == &p)
    return 0;
  for(int i = 0; i < j; i++)
  {
    if (a == &p) foo(p);
  }
  return 0;
}

/* We should be able to remove the call to foo because a is never equal to &p inside the loop.  */
/* { dg-final { scan-tree-dump-not "foo " "optimized"} } */