This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Fix wide-char regressions, wrong types from the FE
- From: "Paul Richard Thomas" <paul dot richard dot thomas at gmail dot com>
- To: "Richard Guenther" <rguenther at suse dot de>
- Cc: gcc-patches at gcc dot gnu dot org, fortran at gcc dot gnu dot org
- Date: Tue, 2 Sep 2008 06:53:49 +0200
- Subject: Re: [PATCH] Fix wide-char regressions, wrong types from the FE
- References: <alpine.LNX.1.10.0808311535161.14563@zhemvz.fhfr.qr>
Richard,
A belated thanks for the patch.
Paul
On Sun, Aug 31, 2008 at 3:37 PM, Richard Guenther <rguenther@suse.de> wrote:
>
> The FE generates multiplications with mismatched types.
>
> Bootstrapped and tested on x86_64-unknown-linux-gnu, applied to the trunk.
>
> Richard.
>
> 2008-08-31 Richard Guenther <rguenther@suse.de>
>
> * trans-expr.c (gfc_trans_string_copy): Use the correct types
> to compute slen and dlen.
>
>
> Index: gcc/fortran/trans-expr.c
> ===================================================================
> *** gcc/fortran/trans-expr.c (revision 139823)
> --- gcc/fortran/trans-expr.c (working copy)
> *************** gfc_trans_string_copy (stmtblock_t * blo
> *** 3066,3075 ****
> /* For non-default character kinds, we have to multiply the string
> length by the base type size. */
> chartype = gfc_get_char_type (dkind);
> ! slen = fold_build2 (MULT_EXPR, size_type_node, slen,
> ! TYPE_SIZE_UNIT (chartype));
> ! dlen = fold_build2 (MULT_EXPR, size_type_node, dlen,
> ! TYPE_SIZE_UNIT (chartype));
>
> if (dlength)
> dest = fold_convert (pvoid_type_node, dest);
> --- 3066,3077 ----
> /* For non-default character kinds, we have to multiply the string
> length by the base type size. */
> chartype = gfc_get_char_type (dkind);
> ! slen = fold_build2 (MULT_EXPR, size_type_node,
> ! fold_convert (size_type_node, slen),
> ! fold_convert (size_type_node, TYPE_SIZE_UNIT (chartype)));
> ! dlen = fold_build2 (MULT_EXPR, size_type_node,
> ! fold_convert (size_type_node, dlen),
> ! fold_convert (size_type_node, TYPE_SIZE_UNIT (chartype)));
>
> if (dlength)
> dest = fold_convert (pvoid_type_node, dest);
>
--
The knack of flying is learning how to throw yourself at the ground and miss.
--Hitchhikers Guide to the Galaxy