[Patch, Fortran] Coarray assumed-shape token and offset handling

Tobias Burnus burnus@net-b.de
Mon Aug 22 21:22:00 GMT 2011


Dear all,

this patch added token/offset support for assumed-shape coarray dummies 
(with .-fcoarray=lib).

Build and regtested.
OK for the trunk?

  * * *


BACKGROUND

For coarrays with -fcoarray=lib, for remote access, one needs to know 
two things: token and offset.

a) A token (of type "void *") identifies the coarray in the library; its 
value is set when the coarray is registered. (For instance, it could 
store the base address of the coarray on all images).

b) The offset between the base address of the coarray and the value one 
wants to assign.

Recall, if
    type(t) :: a(:)[*]
is a coarray (is this case: an assumed-shape dummy argument), then all 
of the following are also coarrays:  a,  a(1:4), a(1), a(1)%direct_comp, 
a(2)%direct_comp(2:7), a(4)%direct_comp(3)



CURRENT IMPLEMENTATION for descriptorless and allocatable coarrays

For descriptorless coarrays (scalar or array), those values are stored 
as language-specific type nodes (TYPE_LANG_SPECIFIC), namely: 
GFC_TYPE_ARRAY_CAF_TOKEN and .GFC_TYPE_ARRAY_CAF_OFFSET.

For descriptorless coarray dummies (scalar or array), the token and the 
offset are passed as hidden dummy arguments - similar to string lengths.


For allocatable coarrays (array and scalar), the cobound is transferred 
via additional dimension triplets and the the token is stored in the 
descriptor as tailing component. The token is accessible via 
gfc_conv_descriptor_token.


THIS PATCH: Assumed-shape coarrays

Assumed shape coarrays are declared as, e.g.,
   integer :: A(:,:)[*]
thus, contrary to deferred-shape/allocatable coarrays, the codimension 
does not need to be passed (and the corank can be differ between actual 
and dummy argument). However, both token and offset are important since 
this information is not passed.

Handled by passing the token/offset as hidden argument and saving it in 
a lang_decl node.

Tobias
-------------- next part --------------
A non-text attachment was scrubbed...
Name: caf_assumed_shape.diff
Type: text/x-patch
Size: 13514 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20110822/32b976fc/attachment.bin>


More information about the Fortran mailing list