trans-expr.c (gfc_trans_string_copy): Use the correct types to compute slen and dlen.

2008-08-31  Richard Guenther  <rguenther@suse.de>

	* trans-expr.c (gfc_trans_string_copy): Use the correct types
	to compute slen and dlen.

From-SVN: r139832
This commit is contained in:
Richard Guenther 2008-08-31 13:40:15 +00:00 committed by Richard Biener
parent 2b2587f577
commit eb829078a3
2 changed files with 11 additions and 4 deletions

View file

@ -1,3 +1,8 @@
2008-08-31 Richard Guenther <rguenther@suse.de>
* trans-expr.c (gfc_trans_string_copy): Use the correct types
to compute slen and dlen.
2008-08-31 Daniel Kraft <d@domob.eu>
* gfortran.h (enum gfc_statement): New entry `ST_GENERIC'.

View file

@ -3066,10 +3066,12 @@ gfc_trans_string_copy (stmtblock_t * block, tree dlength, tree dest,
/* 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));
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);