diff options
author | Richard Stallman <rms@gnu.org> | 1993-05-01 02:59:52 +0000 |
---|---|---|
committer | Richard Stallman <rms@gnu.org> | 1993-05-01 02:59:52 +0000 |
commit | 5f0abdc3ca190343317ef72988e0d49743a34c60 (patch) | |
tree | c3f35208a0a82966607a7ea183637879706f5834 | |
parent | c141a106c0d76ed3187df9bea5551f1178e4f0d9 (diff) | |
download | gcc-5f0abdc3ca190343317ef72988e0d49743a34c60.zip gcc-5f0abdc3ca190343317ef72988e0d49743a34c60.tar.gz gcc-5f0abdc3ca190343317ef72988e0d49743a34c60.tar.bz2 |
(yylex): Avoid invalid shift for erroneous empty char const.
From-SVN: r4292
-rw-r--r-- | gcc/c-lex.c | 7 |
1 files changed, 5 insertions, 2 deletions
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)), |