Fix ICE caused by swallowing a token in c_parser_consume_token
authorKerem Kat <keremkat@gmail.com>
Thu, 16 Jan 2020 23:42:11 +0000 (23:42 +0000)
committerJoseph Myers <joseph@codesourcery.com>
Thu, 16 Jan 2020 23:42:11 +0000 (23:42 +0000)
commit852f0ae80555238c425e33f98df5c7077694bd9f
treeaf3277d077383ad1305ca29e09c7bf5621392927
parentf5b25e15165adde1356af42e9066ab75c5b37a19
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.
gcc/c/ChangeLog
gcc/c/c-parser.c
gcc/testsuite/ChangeLog
gcc/testsuite/c-c++-common/pr92833-1.c [new file with mode: 0644]
gcc/testsuite/c-c++-common/pr92833-2.c [new file with mode: 0644]
gcc/testsuite/c-c++-common/pr92833-3.c [new file with mode: 0644]
gcc/testsuite/c-c++-common/pr92833-4.c [new file with mode: 0644]