c/98200 - improve error recovery for GIMPLE FE
This avoids ICEing by making sure to propagate error early. 2020-12-09 Richard Biener <rguenther@suse.de> PR c/98200 gcc/c/ * gimple-parser.c (c_parser_gimple_postfix_expression): Return early on error. gcc/testsuite/ * gcc.dg/gimplefe-error-8.c: New testcase.
This commit is contained in:
parent
1cb2d1d5ce
commit
42bdf81449
2 changed files with 11 additions and 0 deletions
|
@ -1700,6 +1700,8 @@ c_parser_gimple_postfix_expression (gimple_parser &parser)
|
|||
expr.set_error ();
|
||||
break;
|
||||
}
|
||||
if (expr.value == error_mark_node)
|
||||
return expr;
|
||||
return c_parser_gimple_postfix_expression_after_primary
|
||||
(parser, EXPR_LOC_OR_LOC (expr.value, loc), expr);
|
||||
}
|
||||
|
|
9
gcc/testsuite/gcc.dg/gimplefe-error-8.c
Normal file
9
gcc/testsuite/gcc.dg/gimplefe-error-8.c
Normal file
|
@ -0,0 +1,9 @@
|
|||
/* { dg-do compile } */
|
||||
/* { dg-options "-fgimple" } */
|
||||
|
||||
int __GIMPLE() f(int x, int y)
|
||||
{
|
||||
int a;
|
||||
a = (x < y) ? 1 : 2; /* { dg-error "expected" } */
|
||||
return a;
|
||||
}
|
Loading…
Add table
Reference in a new issue