[Fortran-dev][Patch, Fortran] C_F_Pointer cleanup

Mikael Morin mikael.morin@sfr.fr
Fri Jul 20 09:54:00 GMT 2012


On 15/07/2012 08:23, Tobias Burnus wrote:
> Dear all,
> 
> that's a follow up cleanup to the patch, which has just been merged.
> Most parts should be really obvious and nice, however, the offset part
> isn't. As the offset is not part of the descriptor defined at DTS
> 29113:2012's "8.2 C descriptors" (p. 17), we will have to drop it at
> some point. Hence, I used the less readable name "tmp" and an integer
> divide, instead of multiplying "stride" by "tmp" when setting the "sm"
> and changing "tmp" to, e.g., "size".
> 
> Bootstrapped (with C) and regtested on x86-64-linux.
> OK for the branch?
> 
OK.
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)

Mikael



More information about the Gcc-patches mailing list