mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-04-05 20:01:28 +08:00
Fix ICE caused by swallowing a token in c_parser_consume_token
This patch fixes ICE on invalid code, specifically files that have conflict-marker-like signs before EOF. PR c/92833 gcc/c/ * c-parser.c (c_parser_consume_token): Fix peeked token stack pop to support 4 available tokens. gcc/testsuite/ * c-c++-common/pr92833-1.c, c-c++-common/pr92833-2.c, c-c++-common/pr92833-3.c, c-c++-common/pr92833-4.c: New tests.
This commit is contained in:
parent
f5b25e1516
commit
852f0ae805
@ -1,3 +1,9 @@
|
||||
2020-01-16 Kerem Kat <keremkat@gmail.com>
|
||||
|
||||
PR c/92833
|
||||
* c-parser.c (c_parser_consume_token): Fix peeked token stack pop
|
||||
to support 4 available tokens.
|
||||
|
||||
2020-01-15 Joseph Myers <joseph@codesourcery.com>
|
||||
|
||||
PR c/93072
|
||||
|
@ -846,7 +846,11 @@ c_parser_consume_token (c_parser *parser)
|
||||
{
|
||||
parser->tokens[0] = parser->tokens[1];
|
||||
if (parser->tokens_avail >= 3)
|
||||
parser->tokens[1] = parser->tokens[2];
|
||||
{
|
||||
parser->tokens[1] = parser->tokens[2];
|
||||
if (parser->tokens_avail >= 4)
|
||||
parser->tokens[2] = parser->tokens[3];
|
||||
}
|
||||
}
|
||||
parser->tokens_avail--;
|
||||
}
|
||||
|
@ -1,3 +1,9 @@
|
||||
2020-01-16 Kerem Kat <keremkat@gmail.com>
|
||||
|
||||
PR c/92833
|
||||
* c-c++-common/pr92833-1.c, c-c++-common/pr92833-2.c,
|
||||
c-c++-common/pr92833-3.c, c-c++-common/pr92833-4.c: New tests.
|
||||
|
||||
2020-01-16 Stam Markianos-Wright <stam.markianos-wright@arm.com>
|
||||
|
||||
* g++.target/arm/bfloat_cpp_typecheck.C: New test.
|
||||
|
4
gcc/testsuite/c-c++-common/pr92833-1.c
Normal file
4
gcc/testsuite/c-c++-common/pr92833-1.c
Normal file
@ -0,0 +1,4 @@
|
||||
/* Six marker characters at EOF, causes conflict marker detector to peek 4
|
||||
tokens. */
|
||||
|
||||
/* { dg-error "expected" } */ <<<<<<
|
4
gcc/testsuite/c-c++-common/pr92833-2.c
Normal file
4
gcc/testsuite/c-c++-common/pr92833-2.c
Normal file
@ -0,0 +1,4 @@
|
||||
/* Six marker characters at EOF, causes conflict marker detector to peek 4
|
||||
tokens. */
|
||||
|
||||
/* { dg-error "expected" } */ ======
|
4
gcc/testsuite/c-c++-common/pr92833-3.c
Normal file
4
gcc/testsuite/c-c++-common/pr92833-3.c
Normal file
@ -0,0 +1,4 @@
|
||||
/* Six marker characters at EOF, causes conflict marker detector to peek 4
|
||||
tokens. */
|
||||
|
||||
/* { dg-error "expected" } */ >>>>>>
|
7
gcc/testsuite/c-c++-common/pr92833-4.c
Normal file
7
gcc/testsuite/c-c++-common/pr92833-4.c
Normal file
@ -0,0 +1,7 @@
|
||||
/* Six marker characters at EOF, causes conflict marker detector to peek 4
|
||||
tokens. */
|
||||
|
||||
/* { dg-message "expected" "expected" { target *-*-* } .3 } */
|
||||
>>
|
||||
>>
|
||||
>>
|
Loading…
x
Reference in New Issue
Block a user