Dear Tobias, I think that the patch would be much less opaque if repeated operation to produce code were turned into functions, as I did for the defined assignment patch; eg resolve.c(build_assignment, add_code_to_chain)? What you have done is OK but it is HEAVY, as is much of the content of class.c. However, unless your intestinal fortitude is of a very high order, I suggest that this be left as a latter clean up operation :-)
A nit: + do idx2 = 1, rank + offset = offset + mod (idx, sizes(idx2)) / size(idx2-1) * strides(idx2) + end do s/size(idx2-1)/sizes(idx2-1)/ Apart from that, the patch is OK for trunk. Thanks Paul On 31 December 2012 15:11, Tobias Burnus <bur...@net-b.de> wrote: > Dear all, > > this lengthy patch supports noncontiguous arrays in the finalization > wrapper. That encompasses bother the scalarizer (used for finalizing the > components and for an ELEMENTAL FINAL subroutine) and calling array FINAL > subroutines. For the latter, the subroutine is directly called if possible. > Namely, when the element size of the actual type is the same as the one of > the declared type - and the the FINAL subroutine is either assumed-shape > without the contiguous attribute or the actual argument is contiguous. > Otherwise, the code packs the array. > > The code is written such that it works for any array rank. I explicitly > avoided using GFC_MAX_DIMENSIONS to allow for more ranks without breaking > the ABI. > > The code consists of two new blocks of code. The new function > "finalization_get_offset" which generates the code to translate from an > element index to the byte offset - and in generate_finalization_wrapper to > fill the array "strides" and "sizes", where the latter contains the > multiplied up size, i.e. sizes(0) == 1, sizes(1) = size(array,dim=1), > sizes(2) = sizes(1)*size(array,dim=2) etc. > > Note: Without patch 5/5, this code is never executed. > > Build and regtested on x86-64-gnu-linux - and tested (with the not submitted > patch for invoking the finalizer). > OK for the trunk? > > Tobias -- The knack of flying is learning how to throw yourself at the ground and miss. --Hitchhikers Guide to the Galaxy