aboutsummaryrefslogtreecommitdiff
path: root/gcc/fold-const.c
diff options
context:
space:
mode:
authorUlrich Weigand <uweigand@de.ibm.com>2004-05-22 00:27:23 +0000
committerUlrich Weigand <uweigand@gcc.gnu.org>2004-05-22 00:27:23 +0000
commit12fea1f9fcb7129531fa3f30a0688a80e68b5353 (patch)
tree243d6a13c4c09c0904b6df1c82b25729ad543a10 /gcc/fold-const.c
parentc5042c5c8b8c932c61262226df9fc988d3dd7662 (diff)
downloadgcc-12fea1f9fcb7129531fa3f30a0688a80e68b5353.zip
gcc-12fea1f9fcb7129531fa3f30a0688a80e68b5353.tar.gz
gcc-12fea1f9fcb7129531fa3f30a0688a80e68b5353.tar.bz2
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
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r--gcc/fold-const.c5
1 files changed, 3 insertions, 2 deletions
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;
}