[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[Bug tree-optimization/18694] [4.0 regression] loop miscompilation at -O1 (-ftree-ch)



------- Additional Comments From kazu at cs dot umass dot edu  2004-12-09 01:32 -------
Here is a complete testcase that fails at DOM1.
With -O0, this testcase prints "5 5 5".
With -O1, this testcase prints "5 5 0".

I generated this testcase from final_cleanup after disabling DOM[123].

extern int printf (__const char *__restrict __format, ...); 
 
void
divisors_bug (int *t, unsigned int e)
{
  int * d23;
  unsigned int ivtmp14;
  int * ivtmp7;
  int * d;
  int * tmp;

  d23 = t + 1;
  *d23 = 5;
  if (e != 0) goto L24; else goto L6;

L24:
  tmp = t;
  d = d23;
  ivtmp14 = 0;
  goto L2;

L22:
  ivtmp7 = tmp;

L1:
  d23 = d23 + 1;
  *d23 = *(ivtmp7 + 1);
  ivtmp7 = ivtmp7 + 1;
  if (d > ivtmp7) goto L1; else goto L4;

L4:
  ivtmp14 = ivtmp14 + 1;
  if (e != ivtmp14) goto L23; else goto L6;

L23:
  tmp = d;
  d = d23;

L2:
  if (d > tmp) goto L22; else goto L4;

L6:
  return;
}

int
main (void)
{
  int t[4];
  int i;

  divisors_bug (t,2);
  for(i = 1; i < 4; i++)
    printf ("%d ", t[i]);
  printf ("\n");
  return 0;
}

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18694

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.



Reply to: