re PR middle-end/77842 (genmatch segfault on a missing brace)
authorRichard Biener <rguenther@suse.de>
Wed, 5 Oct 2016 09:36:27 +0000 (09:36 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Wed, 5 Oct 2016 09:36:27 +0000 (09:36 +0000)
2016-10-05  Richard Biener  <rguenther@suse.de>

PR middle-end/77842
* genmatch.c (parser::parse_c_expr): Handle premature EOF.

From-SVN: r240774

gcc/ChangeLog
gcc/genmatch.c

index 34efb7c..b8976e3 100644 (file)
@@ -1,3 +1,8 @@
+2016-10-05  Richard Biener  <rguenther@suse.de>
+
+       PR middle-end/77842
+       * genmatch.c (parser::parse_c_expr): Handle premature EOF.
+
 2016-10-05  Pierre-Marie de Rodat  <derodat@adacore.com>
 
        * dwarf2out.c (dwarf2out_imported_module_or_decl): Move DWARF
index aa291ec..c3f128c 100644 (file)
@@ -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)