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

pinskia at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Thu Dec 9 01:01:00 GMT 2004


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-12-09 01:01 -------
(In reply to comment #12)
Here is a testcase which might be slightly easy to understand it should do (removes *a++):
extern int printf (__const char *__restrict __format, ...); 
 
void 
divisors_bug(long *t, long e, long P) 
{ 
  long int * tmp;
  long int * act_d;
  long int * old_d;
  long int * d;
  long int j;
  
  d = t + 1;
  *d = 5;
  old_d = t;
  j = e;
  while (j != 0) {
    act_d = d;
    tmp = old_d;
    while (tmp < act_d) {
      d++;
      tmp++;
      *d = *tmp;
    }
    old_d = act_d;
    j--;
  }
} 
 
int main(void) 
{ 
  long t[4]; 
  long i; 
  divisors_bug(t,2,2); 
  for(i=1;i<4;i++) 
    printf("%ld ",t[i]); 
  printf("\n"); 
  return 0; 
} 


-- 


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



More information about the Gcc-bugs mailing list