This is the mail archive of the fortran@gcc.gnu.org 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: [Patch, Fortran] Add parsing support for assumed-rank array


Dear Paul,

Paul Richard Thomas wrote:
I am not sure why you do not always pass an actual array descriptor to
the assumed-rank dummy.  This would allow you to pass a scalar by
building a zero rank descriptor with the data pointer set to the
scalar address.

That's my intent. I have to admit that I do not know what the last-posted version of the patch does. But I do know that the patch is not yet fully working. (Hence, there is also the not-yet-implemented error message.)


I put the current patch and a list of to-do items at http://users.physik.fu-berlin.de/~tburnus/tmp/assumed-rank/

On the other hand, if there is some requirement that I do not know
about, which requires the assumed-rank array to have a descriptor with
rank = GFC_MAX_DIMENSIONS but the higher lbounds/ubounds set to zero,
then the scalarizer could be made to cope with that; albeit with a
load of extraneous loops (which would be optimized away?).

No, there is no such requirement. Without C binding, there is no definition and with C binding it is a pointer with a simple "CFI_dim_t dim[];", namely, it takes the "dim" size from the pointer target. If "CFI_rank_t rank" is 0, accessing the "dim" is not allowed.



For details, see DTS 29113; especially "5.2 Assumed-rank objects" but also the rest of the TS. The draft (submitted to an ISO DTS ballot) is at ftp://ftp.nag.co.uk/sc22wg5/N1901-N1950/N1917.pdf



Furthermore, with the help of your RANK intrinsic, Alessandro could implement FINAL, apart from elemental support. This latter could be kludged up by allowing a rank one pointer to point to the assumed-rank array or by passing the array and the elemental
procedure address to a library function.

I concur that it should help with the FINAL implementation. I am not completely sure that I understand the rank-one-pointer klundge. Especially not for the case that the actual argument to the FINAL wrapper is a noncontiguous array.


I think the best solution would be to fix the scalarizer. That would be best for elemental but also for lbound/ubound without dim= argument.

Tobias


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