This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Re: Fwd: gfortran - pointers to components of derived type arrays
- From: "Paul Richard Thomas" <paul dot richard dot thomas at gmail dot com>
- To: "Paul Brook" <paul at codesourcery dot com>
- Cc: "fortran at gcc dot gnu dot org List" <fortran at gcc dot gnu dot org>
- Date: Wed, 11 Apr 2007 20:31:20 +0200
- Subject: Re: Fwd: gfortran - pointers to components of derived type arrays
- Dkim-signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=HKzwHGElnruxIFrOuxCORWLHgSLijtwW5r+Kjh43dJWPT5KwH/NEYyhrkzxrtTmr6aSjtGPXcbNRodtAruFAgqztRrFhol9Eh2vNZTyUoC6JfJh7zi1nfcExwupXwqwXyXIdmnBa8SbU3kLd1e/O+5eJii8PeozspI9I2H5O/ts=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=FsEsy8SSJZgHQSixuRZUPNptr8JbwtMyC7BSDISZlvZjcD0+gVt73CiX/7E/tCLeJ2+te6rA/EoYBsQ128IMiohyVguJx7c0W4xNvXdm6d0KqudW9pXfXzgQM+k4MqM84lT8Kx4qgnmk495ADHn/hseLmzBfZFZpJlKqGB2lEkA=
- References: <339c37f20704100233h3f3f32cfh8101cd00d887c6d0@mail.gmail.com> <200704102145.15107.paul@codesourcery.com> <339c37f20704110815gb29bad9r909f22262a34c1ce@mail.gmail.com> <200704111650.38664.paul@codesourcery.com>
Paul,
> Do I best make the strides and 'offset' pvoid_type_nodes?
No. Strides should have integer type.
Yes, I realised this after presing "send" - duuuh!
I'm not sure about the pointer itself. I suggest trying pointer-to-element.
> Also, is it OK to perform pointer arithmetic directly in
> gfc_build_array_ref, or is there some more intelligent way to do this
> that replaces the build4 (ARRAY_REF....?
I was hoping that you could use the 4th argument of NULL ARRAY_REF.
However tree.def claims this is specified "in units of the alignment of the
element type", which seems a particularly bizarre definition. Maybe we can
get it changed to be a byte offset, and always specify it as 1.
That would be nice.
Ideally we would use this as an excuse to expose proper multi-d addressing to
the middle-end. I'm not sure how practical/hard work that is though. In that
case we can factor out the stride multiplication and put it directly into the
ARRAY_REF.
What is the advantage in doing that? Does that result in more
efficient organisation of the stride multiplication or does it just
make it invisible?
I recommend asking on gcc@ what the best representation would be. There's been
some discussion recently about the representation of indirect references.
Given we're changing things it makes sense to coordinate with the
middle-end/loop optimizer folks to get the right representation.
In fact, somebody wrote to the fortran list, a while since, to say
that they were contemplating doing this.
It would probably be helpful to write a C implementation of what we want, so
that folks not familiar with gfortran can understand what we're trying to
achieve.
OK - however, this is embarking on a road that I do not think that I
have time to go down. In fact, I was trying to make a judgement as to
whether I had the time to try to sort out the first part of the
problem; ie. of the pointers to components of structure arrays, so
that gfortran, at least, gets the missing functionality. Is anybody
interested in helping?
Thanks
Paul