diff options
author | Jakub Jelinek <jakub@redhat.com> | 2000-09-13 01:45:51 +0200 |
---|---|---|
committer | Ulrich Drepper <drepper@gcc.gnu.org> | 2000-09-12 23:45:51 +0000 |
commit | 5c80f6e6b1be7ad5fc64b015e87ee44896595ae6 (patch) | |
tree | 3127d7f2db514a65686b5436b98e35f8d6e6c8bc | |
parent | 8cfccbf35553860b13562b8f60612386e19c39b0 (diff) | |
download | gcc-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
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/c-lex.c | 2 | ||||
-rw-r--r-- | gcc/expr.c | 13 |
3 files changed, 17 insertions, 4 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 46e9945..c6e8733 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2000-09-12 Jakub Jelinek <jakub@redhat.com> + + * 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. + 2000-09-13 Michael Hayes <mhayes@cygnus.com> * loop.c (note_set_pseudo_multiple_uses): Correct. diff --git a/gcc/c-lex.c b/gcc/c-lex.c index fa5c7a7..f9c5cb4 100644 --- a/gcc/c-lex.c +++ b/gcc/c-lex.c @@ -2381,7 +2381,7 @@ lex_string (str, len, wide) if (wide) { unsigned charwidth = TYPE_PRECISION (char_type_node); - unsigned bytemask = (1 << width) - 1; + unsigned bytemask = (1 << charwidth) - 1; int byte; for (byte = 0; byte < WCHAR_BYTES; ++byte) @@ -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)])); + } } } } |