RFC: Handling of Coarrays with Regards to Allocatable Components
Tobias Burnus
burnus@net-b.de
Fri Jun 13 20:21:00 GMT 2014
Hi everyone,
when doing a derived-type assignment, allocatable components are also
assigned. The same happens when doing
derived_type_var = coarray_derived_type_var[remote_image_idx]
If the allocatable is of polymorphic component, the information about
allocatable components of the polymorphic component is not available
when compiling the line above. Thus, we have to generate a "caf_get"
subroutine for the actual type, which does the copying. (That's also how
we already handle polymorphic-component assignments. The polymorphic
variable/component then points to a "virtual table" for the dynamic type
which contains the procedure pointer to the _copy for that type.)
One has two options: Either generating the "caf_copy" subroutine only
with -fcoarray=lib â or to generate them unconditionally. What do you
think is the better option?
a) Generating caf_copy only with -fcoarray=lib:
+ Saves memory when no coarrays are used
â Might lead to run time failures when mixing code compiled with
-fcoarray=lib and without, but only when the coarray code uses a derived
type, which itself (or an extension used as actual type) is declared in
a file compiled without -fcoarray=lib
b) Always generating caf_get/caf_send
+ Avoids issues with mixing -fcoarray=lib code with other code
â Requires that the called library functions generated for -fcoarray=lib
are always available. One might provide a do-nothing stub in libgfortran
and override them in the actual libcaf_* library when linking the
latter. (Requires weak symbols.)
â Breaks the ABI for all polymorphic code (but that's already required
for the new array descriptor)
What do you think would be best?
Tobias
More information about the Fortran
mailing list