This is the mail archive of the mailing list for the GNU Fortran 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: Fwd: gfortran - pointers to components of derived type arrays


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. 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>; = (void *) &(*(int4[0:] *)[(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; = (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:)



Saint Augustine - "O Lord, help me to be pure, but not yet"

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