This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Re: RFC: Handling of Coarrays with Regards to Allocatable Components
- From: Paul Richard Thomas <paul dot richard dot thomas at gmail dot com>
- To: Tobias Burnus <burnus at net-b dot de>
- Cc: gfortran <fortran at gcc dot gnu dot org>
- Date: Sat, 14 Jun 2014 19:39:35 +0200
- Subject: Re: RFC: Handling of Coarrays with Regards to Allocatable Components
- Authentication-results: sourceware.org; auth=none
- References: <539B5D46 dot 2080603 at net-b dot de>
Dear Tobias,
My suggestion would be to go with a) and, if it turns out to be an
issue, convert to b) later on. I cannot help but feel that if we are
clear about the need to compile consistently with -fcoarray=lib it
should not be a problem.
With best regards
Paul
On 13 June 2014 22:21, Tobias Burnus <burnus@net-b.de> wrote:
> 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
>
--
The knack of flying is learning how to throw yourself at the ground and miss.
--Hitchhikers Guide to the Galaxy