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.
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);
}
--- /dev/null
+/* { 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;
+}