Just noticed a few issues when feeding the GIMPLE FE random -gimple dumps. On errors not skipping to expected tokens leads to a load of strange followup parsing errors and worse, to endless parsing attempts in one case.
Fixed with the following. Bootstrap / regtest running together with the pass manager change posted in the other thread. I consider gimple-parser.c changes like this "middle-end", Joseph, are you fine with that? Richard. 2016-12-20 Richard Biener <rguent...@suse.de> c/ * gimple-parser.c (c_parser_gimple_compound_statement): Improve error recovery. (c_parser_gimple_statement): Only build assigns for non-error stmts. (c_parser_gimple_postfix_expression_after): Improve error recovery. Index: gcc/c/gimple-parser.c =================================================================== --- gcc/c/gimple-parser.c (revision 243738) +++ gcc/c/gimple-parser.c (working copy) @@ -215,7 +215,7 @@ c_parser_gimple_compound_statement (c_pa expr_stmt: c_parser_gimple_statement (parser, seq); if (! c_parser_require (parser, CPP_SEMICOLON, "expected %<;%>")) - return return_p; + c_parser_skip_until_found (parser, CPP_SEMICOLON, NULL); } } c_parser_consume_token (parser); @@ -327,9 +327,12 @@ c_parser_gimple_statement (c_parser *par case CPP_NOT: case CPP_MULT: /* pointer deref */ rhs = c_parser_gimple_unary_expression (parser); - assign = gimple_build_assign (lhs.value, rhs.value); - gimple_set_location (assign, loc); - gimple_seq_add_stmt (seq, assign); + if (rhs.value != error_mark_node) + { + assign = gimple_build_assign (lhs.value, rhs.value); + gimple_set_location (assign, loc); + gimple_seq_add_stmt (seq, assign); + } return; default:; @@ -385,10 +388,13 @@ c_parser_gimple_statement (c_parser *par && lookup_name (c_parser_peek_token (parser)->value)) { rhs = c_parser_gimple_unary_expression (parser); - gimple *call = gimple_build_call_from_tree (rhs.value); - gimple_call_set_lhs (call, lhs.value); - gimple_seq_add_stmt (seq, call); - gimple_set_location (call, loc); + if (rhs.value != error_mark_node) + { + gimple *call = gimple_build_call_from_tree (rhs.value); + gimple_call_set_lhs (call, lhs.value); + gimple_seq_add_stmt (seq, call); + gimple_set_location (call, loc); + } return; } @@ -802,7 +808,10 @@ c_parser_gimple_postfix_expression_after tree idx = c_parser_gimple_unary_expression (parser).value; if (! c_parser_require (parser, CPP_CLOSE_SQUARE, "expected %<]%>")) - break; + { + c_parser_skip_until_found (parser, CPP_CLOSE_SQUARE, NULL); + break; + } start = expr.get_start (); finish = c_parser_tokens_buf (parser, 0)->location;