aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/parser.c
diff options
context:
space:
mode:
authorNathan Sidwell <nathan@acm.org>2019-11-05 16:59:41 +0000
committerNathan Sidwell <nathan@gcc.gnu.org>2019-11-05 16:59:41 +0000
commit3fd4f9242d9b7d2032126dc4851b4fdf5628dc35 (patch)
tree4695f86233e960ab7da052354dec811c70c88f87 /gcc/cp/parser.c
parentb00460cb14ef64b3bc5348eef94aa177c642d4b4 (diff)
downloadgcc-3fd4f9242d9b7d2032126dc4851b4fdf5628dc35.zip
gcc-3fd4f9242d9b7d2032126dc4851b4fdf5628dc35.tar.gz
gcc-3fd4f9242d9b7d2032126dc4851b4fdf5628dc35.tar.bz2
[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
Diffstat (limited to 'gcc/cp/parser.c')
-rw-r--r--gcc/cp/parser.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index 3ed282f..bce7161 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -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;