Commit 5c80f6e6 by Jakub Jelinek Committed by Ulrich Drepper

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
parent 8cfccbf3
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.
......
......@@ -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,12 +6619,19 @@ expand_expr (exp, target, tmode, modifier)
else if (TREE_CODE (init) == STRING_CST
&& 0 > compare_tree_int (index,
TREE_STRING_LENGTH (init)))
{
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)]));
}
}
}
}
/* Fall through. */
case COMPONENT_REF:
......
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