aboutsummaryrefslogtreecommitdiff
path: root/gcc/expr.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2000-09-13 01:45:51 +0200
committerUlrich Drepper <drepper@gcc.gnu.org>2000-09-12 23:45:51 +0000
commit5c80f6e6b1be7ad5fc64b015e87ee44896595ae6 (patch)
tree3127d7f2db514a65686b5436b98e35f8d6e6c8bc /gcc/expr.c
parent8cfccbf35553860b13562b8f60612386e19c39b0 (diff)
downloadgcc-5c80f6e6b1be7ad5fc64b015e87ee44896595ae6.zip
gcc-5c80f6e6b1be7ad5fc64b015e87ee44896595ae6.tar.gz
gcc-5c80f6e6b1be7ad5fc64b015e87ee44896595ae6.tar.bz2
c-lex.c (lex_string): Use charwidth to compute bytemask.
* c-lex.c (lex_string): Use charwidth to compute bytemask. * expr.c (expand_expr): Don't optimize constant array references initialized with wide string constants. From-SVN: r36380
Diffstat (limited to 'gcc/expr.c')
-rw-r--r--gcc/expr.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/gcc/expr.c b/gcc/expr.c
index 9c4237b..baa4ef1 100644
--- a/gcc/expr.c
+++ b/gcc/expr.c
@@ -6619,9 +6619,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)]));
+ }
}
}
}