[J3] Coarrays + CO_REDUCE and (polymorphic) allocatable components
John Reid
John.Reid at stfc.ac.uk
Thu Mar 18 20:41:12 UTC 2021
Tobias,
For co_reduce (see 16.9.49) we have "A shall not be polymorphic." I
think we overlooked the case where A is of a type with a polymorphic
component or more generally with a polymorphic ultimate component.
John.
Tobias Burnus via J3 wrote:
> Hi all,
>
> I was wondering whether the following is valid:
>
> type t
> integer, allocatable :: A(:)
> type(t), allocatable :: B
> class(*), allocatable :: C
> end type t
>
> type(t) :: var[*]
>
> ...
> call co_reduce(var, my_red_fn)
>
> At a glance, I could not find anything which states that
> this is invalid, but I note that for a distributed-memory
> implementation, the CO_REDUCE has to remotely access
> var[i]%A and var[i]%B
> before calling 'my_red_fn' locally – and especially
> resolving the dynamic type of 'B' might be difficult.
>
> And worse is the part about distributing the data back to
> the result_image or all images, in particular if the
> shape/dynamic type does not match.
>
> For data-ref, there is:
>
> C917 (R911) Except as an actual argument to an
> intrinsic inquiry function or as the designator in a
> type parameter inquiry, a data-ref shall not be a
> coindexed object that has a polymorphic allocatable
> potential subobject component
>
> C918 Except as an actual argument to an intrinsic
> inquiry function or as the designator in a type parameter
> inquiry, if the rightmost part-ref is polymorphic,
> no other part-ref shall be coindexed.
>
> And for CO_REDUCE, there is: "'A' shall not be polymorphic."
>
>
> Is this intended to be valid? Did I miss some constraint?
> Or was this an oversight?
>
>
> Tobias
>
More information about the J3
mailing list