summaryrefslogtreecommitdiff
path: root/gcc/c-lex.c
diff options
context:
space:
mode:
authorrms <rms@138bc75d-0d04-0410-961f-82ee72b054a4>1993-05-01 02:59:52 +0000
committerrms <rms@138bc75d-0d04-0410-961f-82ee72b054a4>1993-05-01 02:59:52 +0000
commit3d51d515be41b95c8dc7e6255b183acb9064ef42 (patch)
treec3f35208a0a82966607a7ea183637879706f5834 /gcc/c-lex.c
parent64dc698a7c548f4e317dae8fb36eea44e8edaf95 (diff)
downloadgcc-3d51d515be41b95c8dc7e6255b183acb9064ef42.tar.gz
(yylex): Avoid invalid shift for erroneous empty char const.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@4292 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/c-lex.c')
-rw-r--r--gcc/c-lex.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/gcc/c-lex.c b/gcc/c-lex.c
index 13ec3a229aa..6c0515bef60 100644
--- a/gcc/c-lex.c
+++ b/gcc/c-lex.c
@@ -1847,8 +1847,11 @@ yylex ()
if (! wide_flag)
{
int num_bits = num_chars * width;
- if (TREE_UNSIGNED (char_type_node)
- || ((result >> (num_bits - 1)) & 1) == 0)
+ if (num_bits == 0)
+ /* We already got an error; avoid invalid shift. */
+ yylval.ttype = build_int_2 (0, 0);
+ else if (TREE_UNSIGNED (char_type_node)
+ || ((result >> (num_bits - 1)) & 1) == 0)
yylval.ttype
= build_int_2 (result & ((unsigned HOST_WIDE_INT) ~0
>> (HOST_BITS_PER_WIDE_INT - num_bits)),