[PATCH] Fix wide-char regressions, wrong types from the FE

Paul Richard Thomas paul.richard.thomas@gmail.com
Tue Sep 2 04:54:00 GMT 2008


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



More information about the Fortran mailing list