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: [Fortran-dev][Patch, Fortran] C_F_Pointer cleanup


On 07/20/2012 11:52 AM, Mikael Morin wrote
OK.

Thanks for the review.


I guess the division will be dropped too (the middle-end does the
reverse multiplication implicitly in the pointer arithmetic).
I wonder which one is faster (the casts in the second version are
certainly not nice for the middle-end):

ptr + (offset_in_bytes / elt_size_in_bytes)
VS
(sometype *) (((char *)ptr) + offset_in_bytes)

As we have to support strides which aren't multiples of the element size, we have to use the second form. We currently do so for BT_CLASS but not for BT_TYPE. Actually, half of the remaining failures on the branch seem to be due to the wrong usage of stride- vs. byte-based offsets. For instance in SELECT TYPE .. TYPE IS, where one has a BT_TYPE and which fails.


I think the conversion to byte offsets will be the next step. Afterwards, we should get rid of the offset.

Tobias


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