aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Kenner <kenner@gcc.gnu.org>1994-07-26 19:45:11 -0400
committerRichard Kenner <kenner@gcc.gnu.org>1994-07-26 19:45:11 -0400
commitad2e7dd004513e4877bf837f4113815ada04c7f0 (patch)
tree797513b44652024533be4b703d8e923b03306bbf
parentee7204ee5524237c31037d427422137a349cb253 (diff)
downloadgcc-ad2e7dd004513e4877bf837f4113815ada04c7f0.zip
gcc-ad2e7dd004513e4877bf837f4113815ada04c7f0.tar.gz
gcc-ad2e7dd004513e4877bf837f4113815ada04c7f0.tar.bz2
(expand_expr, case ARRAY_REF): Don't fold L"foo"[2].
From-SVN: r7797
-rw-r--r--gcc/expr.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/gcc/expr.c b/gcc/expr.c
index e764986..62eb5b8 100644
--- a/gcc/expr.c
+++ b/gcc/expr.c
@@ -4340,13 +4340,16 @@ expand_expr (exp, target, tmode, modifier)
}
/* 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
&& TREE_CODE (index) == INTEGER_CST
&& !TREE_INT_CST_HIGH (index)
&& (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]);
/* If this is a constant index into a constant array,