Commit ad2e7dd0 by Richard Kenner

(expand_expr, case ARRAY_REF): Don't fold L"foo"[2].

From-SVN: r7797
parent ee7204ee
...@@ -4340,13 +4340,16 @@ expand_expr (exp, target, tmode, modifier) ...@@ -4340,13 +4340,16 @@ expand_expr (exp, target, tmode, modifier)
} }
/* Fold an expression like: "foo"[2]. /* Fold an expression like: "foo"[2].
This is not done in fold so it won't happen inside &. */ This is not done in fold so it won't happen inside &.
Don't fold if this is for wide characters since it's too
difficult to do correctly and this is a very rare case. */
if (TREE_CODE (array) == STRING_CST if (TREE_CODE (array) == STRING_CST
&& TREE_CODE (index) == INTEGER_CST && TREE_CODE (index) == INTEGER_CST
&& !TREE_INT_CST_HIGH (index) && !TREE_INT_CST_HIGH (index)
&& (i = TREE_INT_CST_LOW (index)) < TREE_STRING_LENGTH (array) && (i = TREE_INT_CST_LOW (index)) < TREE_STRING_LENGTH (array)
&& GET_MODE_CLASS (mode) == MODE_INT) && GET_MODE_CLASS (mode) == MODE_INT
&& GET_MODE_SIZE (mode) == 1)
return GEN_INT (TREE_STRING_POINTER (array)[i]); return GEN_INT (TREE_STRING_POINTER (array)[i]);
/* If this is a constant index into a constant array, /* If this is a constant index into a constant array,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment