diff options
Diffstat (limited to 'gcc/expr.c')
-rw-r--r-- | gcc/expr.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/gcc/expr.c b/gcc/expr.c index 7d7f92dab30..edbdc2c1806 100644 --- a/gcc/expr.c +++ b/gcc/expr.c @@ -6618,9 +6618,16 @@ expand_expr (exp, target, tmode, modifier) else if (TREE_CODE (init) == STRING_CST && 0 > compare_tree_int (index, TREE_STRING_LENGTH (init))) - return (GEN_INT - (TREE_STRING_POINTER - (init)[TREE_INT_CST_LOW (index)])); + { + tree type = TREE_TYPE (TREE_TYPE (init)); + enum machine_mode mode = TYPE_MODE (type); + + if (GET_MODE_CLASS (mode) == MODE_INT + && GET_MODE_SIZE (mode) == 1) + return (GEN_INT + (TREE_STRING_POINTER + (init)[TREE_INT_CST_LOW (index)])); + } } } } |