From a5382f1c6b729ce1cce0c76db8139f4dbe3caae7 Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Wed, 5 Oct 2016 09:36:27 +0000 Subject: [PATCH] re PR middle-end/77842 (genmatch segfault on a missing brace) 2016-10-05 Richard Biener PR middle-end/77842 * genmatch.c (parser::parse_c_expr): Handle premature EOF. From-SVN: r240774 --- gcc/ChangeLog | 5 +++++ gcc/genmatch.c | 2 ++ 2 files changed, 7 insertions(+) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 34efb7c..b8976e3 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2016-10-05 Richard Biener + + PR middle-end/77842 + * genmatch.c (parser::parse_c_expr): Handle premature EOF. + 2016-10-05 Pierre-Marie de Rodat * dwarf2out.c (dwarf2out_imported_module_or_decl): Move DWARF diff --git a/gcc/genmatch.c b/gcc/genmatch.c index aa291ec..c3f128c 100644 --- a/gcc/genmatch.c +++ b/gcc/genmatch.c @@ -4124,6 +4124,8 @@ parser::parse_c_expr (cpp_ttype start) else if (token->type == end && --opencnt == 0) break; + else if (token->type == CPP_EOF) + fatal_at (token, "unexpected end of file"); /* This is a lame way of counting the number of statements. */ if (token->type == CPP_SEMICOLON) -- 2.7.4