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: gfortran IRC meeting?

FWIW, I updated the tentative header file example in with info from N1845.

One thing which caught my eye was 5.2.3:

"For a descriptor of an assumed-shape array, the value of the
lower-bound member of each element of the dim member of the descriptor
shall be zero."

- As the TR descriptor does not have an offset field like the current
gfortran one, in combination with the above it seems the idea in the
TR is to have 0-based indexing as the "native" model (that is,
subtract 1 from the Fortran index to get the real offset from the data
pointer); thus do we need to change the code we generate e.g. for
"A(x, y)" so that we calculate (x-1) and (y-1) etc. instead of having
a separate offset?

- Does the above imply that for assumed-shape dummy arguments, it
should be the responsibility of the caller to ensure that the
descriptor has the correct bounds rather than fixing it up in the
callee as we do now? I suspect that if gfortran would also change to
the TR-style 0-based indexing, this might be a slight improvement in
the common case where arrays have default lower bounds. However, for
arrays with non-default lower bound the caller would maybe need to do
something like

tmplbounds[] = descriptor.dim[].lbound
descriptor.dim[].lbound = 0
call procedure with assumed-shape dummy argument
descriptor.dim[].lbound = tmplbounds[]


Janne Blomqvist

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