phi_bad.c 346 Bytes
Newer Older
Michael Beck's avatar
Michael Beck committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
static int A;

/* This function produces unnecessary Phi nodes due to the way
 * x is assigned. Note: This is not a bug, its by the Phi construction algorithm. */
void test(int l, int m) {
  int i, x = m;

  for (i = 0; i < l; ++i) {
    A = x;

    if (l > 5)
      x = m;
  }
}

int main()
{
  test(4,5);
  printf("A = %d\n", A);
Matthias Braun's avatar
Matthias Braun committed
20
  return 0;
Michael Beck's avatar
Michael Beck committed
21
}