From 5f0abdc3ca190343317ef72988e0d49743a34c60 Mon Sep 17 00:00:00 2001 From: Richard Stallman Date: Sat, 1 May 1993 02:59:52 +0000 Subject: (yylex): Avoid invalid shift for erroneous empty char const. From-SVN: r4292 --- gcc/c-lex.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'gcc') diff --git a/gcc/c-lex.c b/gcc/c-lex.c index 13ec3a2..6c0515b 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)), -- cgit v1.1