[gfortran] Avoid induction variables in DO loops.

Sebastian Pop sebastian.pop@cri.ensmp.fr
Fri Oct 8 09:06:00 GMT 2004


On Fri, Oct 08, 2004 at 08:57:08AM +0800, Canqun Yang wrote:
> 
> My newest test shows that LNO branch can do data 
> dependence analysis for arrays with known bounds, but  
> not unknown bounds. Below is an Fortran example.
> 
> subroutine array_ref (a, b, c, N)
>    real a(N, N), b(N, N), c(N, N)
>    do i = 1, N
>      do j = 1, N
>        c(j, i) = a(j, i) * b(j, i)
>      enddo
>    enddo
> end
> 
> 

If you want to test the data dependence analysis, you should probably
write your cases in C (this thread clearly shows the problem with our
FORTRAN front-end...) ;-)

I see no problem in analyzing the following code: 

void foo (int N)
{
  double a[N][N];
  double b[N][N];
  double c[N][N];

  for (i = 0; i < N; i++)
    for (j = 0; j < N; j++)
      c[i][j] = a[i][j] * b[i][j];
}

For the swim case the analyzer needs to know the dimension of the data
because without it, there are data dependences that it cannot discard,
and consequently the loop interchange is not valid.

Sebastian



More information about the Fortran mailing list