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: "Tobias Burnus" <burnus at net-b dot de>
- Cc: "fortran at gcc dot gnu dot org List" <fortran at gcc dot gnu dot org>, paul at codesourcery dot com
- Date: Wed, 11 Apr 2007 21:10:00 +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=ZCjmCD5sQmMKJ331BBGx+HC94O9coW4WL37N/BMhn3HE54yTo/FIrCUMyxuMn6O8t8mlOQTFgsrwYasRWxQeqQAyaX/kqiSdwO64jr4ps8B2bT8KUAJoL4eNFyYVb8U6v9rsad8owI2JD7vGKuA3rxPVhEMwc9H3BW+V73T3vg4=
- 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=QxcK8hzBRl/ewM8JFYrV1YDuExO5HcO0G7zkOrKU8g57jofmempLY6Za7BeZOOOErlV0uPW1UmKYgWIFumpQyxYXorYSgIRYc0VcZMKMiJawRfdSvH6TWYunbP+u+pMl3ZdiCnx44SZwLdXEVgbpaBHnIWxk7U2CB5HcwzgxW5M=
- References: <339c37f20704100233h3f3f32cfh8101cd00d887c6d0@mail.gmail.com> <200704102145.15107.paul@codesourcery.com> <339c37f20704110815gb29bad9r909f22262a34c1ce@mail.gmail.com> <461D28C8.5060502@net-b.de>
Tobias,
I just want to mention that Fortran 2003 has some extensions in that
area and I want to make sure that you are at least aware of them when
implementing the missing Fortran 95 bits.
I am aware of these extensions.
Cf. ftp://ftp.nag.co.uk/sc22wg5/N1601-N1650/N1648.pdf Section 3.7
"Pointer assignment"
p(0:,0:) => a ! specify lower bounds
p(1:m,1:2*m) => a(1:2*m*m) ! remap rank one array
These examples appear in Metcalfe, Reid and Cohen too, if I recall correctly.
(I need first to reread the emails and study trans-* before I could
comment on the rest.)
I tried lifting 2395:2400 of expr.c to see what gfortran would make of
these lines. To my amazement, code is produced, even if it is rather
screwy.
The rank remapping produces:
{
int4 D.1005;
int4 D.1004;
struct array2_int4 parm.0;
parm.0.dtype = 266;
D.1004 = p.dim[0].stride;
parm.0.dim[0].lbound = 1;
parm.0.dim[0].ubound = 2;
parm.0.dim[0].stride = NON_LVALUE_EXPR <D.1004>;
D.1005 = p.dim[1].stride;
parm.0.dim[1].lbound = 1;
parm.0.dim[1].ubound = 4;
parm.0.dim[1].stride = NON_LVALUE_EXPR <D.1005>;
parm.0.data = (void *) &(*(int4[0:] *) p.data)[(1 - p.dim[0].lbound) * D.100
4 + (1 - p.dim[1].lbound) * D.1005];
parm.0.offset = 0;
parm.0.dtype = 266;
parm.0.dim[0].lbound = 1;
parm.0.dim[0].ubound = 8;
parm.0.dim[0].stride = 1;
parm.0.data = (void *) &a[0];
parm.0.offset = -1;
}
So the necessary could easily be done in trans-array.c and
trans-expr.c - over to you:)
Cheers
Paul
--
Saint Augustine - "O Lord, help me to be pure, but not yet"