summaryrefslogtreecommitdiff
path: root/gcc/fold-const.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r--gcc/fold-const.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index c35f987ab89..afc3b7f8772 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -15433,7 +15433,7 @@ fold_read_from_constant_string (tree exp)
if (string
&& TYPE_MODE (TREE_TYPE (exp)) == TYPE_MODE (TREE_TYPE (TREE_TYPE (string)))
&& TREE_CODE (string) == STRING_CST
- && TREE_CODE (index) == INTEGER_CST
+ && tree_fits_uhwi_p (index)
&& compare_tree_int (index, TREE_STRING_LENGTH (string)) < 0
&& is_int_mode (TYPE_MODE (TREE_TYPE (TREE_TYPE (string))),
&char_mode)