This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH 08/25] Fix co-array allocation
- From: Janne Blomqvist <blomqvist dot janne at gmail dot com>
- To: Toon Moene <toon at moene dot org>, ams at codesourcery dot com, GCC Patches <gcc-patches at gcc dot gnu dot org>, Fortran List <fortran at gcc dot gnu dot org>
- Date: Wed, 5 Sep 2018 21:07:09 +0300
- Subject: Re: [PATCH 08/25] Fix co-array allocation
- References: <024e798b9539b765a1259cfc9cb2f1dc480b24ca.1536144068.git.ams@codesourcery.com> <7f5064c3-afc6-b7b5-cade-f03af5b86331@moene.org>
Please send fortran patches to the fortran list as well!
On Wed, Sep 5, 2018 at 7:54 PM Toon Moene <toon@moene.org> wrote:
>
>
>
> -------- Forwarded Message --------
> Subject: [PATCH 08/25] Fix co-array allocation
> Date: Wed, 5 Sep 2018 12:49:40 +0100
> From: ams@codesourcery.com
> To: gcc-patches@gcc.gnu.org
>
>
> The Fortran front-end has a bug in which it uses "int" values for "size_t"
> parameters. I don't know why this isn't problem for all 64-bit
> architectures,
> but GCN ends up with the data in the wrong argument register and/or
> stack slot,
> and bad things happen.
>
> This patch corrects the issue by setting the correct type.
>
> 2018-09-05 Kwok Cheung Yeung <kcy@codesourcery.com>
>
> gcc/fortran/
> * trans-expr.c (gfc_trans_structure_assign): Ensure that
> integer_zero_node is of sizetype when used as the first
> argument of a call to _gfortran_caf_register.
>
The argument must be of type size_type_node, not sizetype. Please instead
use
size = build_zero_cst (size_type_node);
> * trans-intrinsic.c (conv_intrinsic_event_query): Convert computed
> index to a size_t type.
>
Using integer_type_node is wrong, but the correct type for calculating
array indices (lbound, ubound, etc.) is not size_type_node but rather
gfc_array_index_type (which in practice maps to ptrdiff_t). So please use
that, and then fold_convert index to size_type_node just before generating
the call to event_query.
> * trans-stmt.c (gfc_trans_event_post_wait): Likewise.
>
Same here as above.
Thanks,
--
Janne Blomqvist