This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [lno] [patch] vectorizer update - loop bound


On Tuesday 20 January 2004 5:09 pm, Dorit Naishlos wrote:
> > In gfortran we currently flatten all array access into a 0-based one
> > dimensional array pointer.
> >
> > This is something that I hope to address fairly soon. To be done properly
>
> I
>
> > think it requires the addition of additional semantics for ARRAY_TYPEs,
> > and/or an extra lowering pass.
>
> I'm not sure I understand - Do you mean that the TYPE_MIN_VALUE of the
> arrays is always set to 0, but the references are not yet modified
> accordingly?

We never addess an array object directly. We always create a pointer to an 
array with a TYPE_MIN_VALUE of zero and unknown length, and point that at 
wherever we need to.

In the example given by Toon a(1) is the first element of the array, so we 
point the pointer at the element before the start of the array. The 
equivalent C code is something like:

int main()
{
  float a[1000];
  int i;
  float *p;

  p=a[-1];
  for (i=1; i <= 1000; i++)
    p[i] = logf (1.0f)
}

Yes, it's evil, but seemed the easiest way of handling all the things fortran 
can do with arrays. It gets even more fun for multidimensional arrays.
Using array types properly is fairly high on my list of things to fix.

> If I compile Toon's example below with gfortran, I get 0 for TYPE_MIN_VALUE
> (TYPE_DOMAIN (array_type)). Is that an expected behavior?

Yes.

> If so, does the
> compiler have a way to find what is the correct first index?

Probably not. The valid elements of the array may not be contiguous either.

Paul


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]