From 12fea1f9fcb7129531fa3f30a0688a80e68b5353 Mon Sep 17 00:00:00 2001 From: Ulrich Weigand Date: Sat, 22 May 2004 00:27:23 +0000 Subject: [PATCH] fold-const.c (fold_read_from_constant_string): Convert result to requested type. * fold-const.c (fold_read_from_constant_string): Convert result to requested type. From-SVN: r82120 --- gcc/ChangeLog | 5 +++++ gcc/fold-const.c | 5 +++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 5196058..a0e205e 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2004-05-21 Ulrich Weigand + + * fold-const.c (fold_read_from_constant_string): Convert result to + requested type. + 2004-05-21 Richard Henderson * gimplify.c (mostly_copy_tree_r): Don't attempt to copy decls. diff --git a/gcc/fold-const.c b/gcc/fold-const.c index 2c89c5b..ba683ad 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -9692,8 +9692,9 @@ fold_read_from_constant_string (tree exp) && (GET_MODE_CLASS (TYPE_MODE (TREE_TYPE (TREE_TYPE (string)))) == MODE_INT) && (GET_MODE_SIZE (TYPE_MODE (TREE_TYPE (TREE_TYPE (string)))) == 1)) - return build_int_2 ((TREE_STRING_POINTER (string) - [TREE_INT_CST_LOW (index)]), 0); + return fold_convert (TREE_TYPE (exp), + build_int_2 ((TREE_STRING_POINTER (string) + [TREE_INT_CST_LOW (index)]), 0)); } return NULL; } -- 2.7.4