Im writing to you regarding a possible bug in linear loop transfor.
The bug can be reproduce by compiling the attached c file with gcc.4.5.0 
(20100204, 20100325) on x86 machine.

The compiler flags that reproduce the error are:
-O2 -fno-inline -fno-tree-ch -ftree-loop-linear

If the compiler is run with:
-O2 -fno-inline -fno-tree-ch -fno-tree-loop-linear 
then the produced code is correct.


      
#include <stdio.h>

int test (int n, int *a)
{
  int i, j;

  for (i = 0; i < n; i++)
    {
      for (j = 0; j < n; j++)
        {
          a[j] = i + n;
        }
    }


    if (a[0] != 31 || i + n - 1 != 31)
       printf("incorrect %d  %d \n", a[0], i+n-1);      

  return 0;
}

int main (void)
{
  int a[16];
  test (16, a);
  return 0;
}

Reply via email to