[PR c++/92370] ICE with VC marker

https://gcc.gnu.org/ml/gcc-patches/2019-11/msg00323.html
	cp/
	PR c++/92370
	* parser.c (cp_parser_error_1): Check EOF and UNKNOWN_LOCATION
	when skipping over version control marker.

	testsuite/
	PR c++/92370
	* g++.dg/pr92370.C: New.

From-SVN: r277853
This commit is contained in:
Nathan Sidwell 2019-11-05 16:59:41 +00:00 committed by Nathan Sidwell
parent b00460cb14
commit 3fd4f9242d
4 changed files with 20 additions and 2 deletions

View File

@ -1,3 +1,9 @@
2019-11-05 Nathan Sidwell <nathan@acm.org>
PR c++/92370
* parser.c (cp_parser_error_1): Check EOF and UNKNOWN_LOCATION
when skipping over version control marker.
2019-11-05 Jakub Jelinek <jakub@redhat.com>
PR c++/92343

View File

@ -2890,12 +2890,16 @@ cp_parser_error_1 (cp_parser* parser, const char* gmsgid,
error_at (loc, "version control conflict marker in file");
expanded_location token_exploc = expand_location (token->location);
/* Consume tokens until the end of the source line. */
while (1)
for (;;)
{
cp_lexer_consume_token (parser->lexer);
cp_token *next = cp_lexer_peek_token (parser->lexer);
if (next == NULL)
if (next->type == CPP_EOF)
break;
if (next->location == UNKNOWN_LOCATION
|| loc == UNKNOWN_LOCATION)
break;
expanded_location next_exploc = expand_location (next->location);
if (next_exploc.file != token_exploc.file)
break;

View File

@ -1,3 +1,8 @@
2019-11-05 Nathan Sidwell <nathan@acm.org>
PR c++/92370
* g++.dg/pr92370.C: New.
2019-11-04 Martin Sebor <msebor@redhat.com>
PR middle-end/92341

View File

@ -0,0 +1,3 @@
// PR 92370 ICE with conlict marker
<<<<<<<>>>>>>> // { dg-error "conflict marker" }