Commit efd0786f by Marek Polacek Committed by Marek Polacek

re PR c/71853 (ICE on an ill-formed case statement in c_do_switch_warnings)

	PR c/71853
	* c-parser.c (c_parser_switch_statement): Initialize ce.original_type
	to error node for invalid code.

	* gcc.dg/noncompile/pr71853.c: New test.

From-SVN: r238884
parent f618a472
...@@ -3,6 +3,10 @@ ...@@ -3,6 +3,10 @@
PR c/71742 PR c/71742
* c-decl.c (finish_struct): Rephrase an error message. * c-decl.c (finish_struct): Rephrase an error message.
PR c/71853
* c-parser.c (c_parser_switch_statement): Initialize ce.original_type
to error node for invalid code.
2016-07-29 Jakub Jelinek <jakub@redhat.com> 2016-07-29 Jakub Jelinek <jakub@redhat.com>
PR c/71969 PR c/71969
......
...@@ -5661,6 +5661,7 @@ c_parser_switch_statement (c_parser *parser, bool *if_p) ...@@ -5661,6 +5661,7 @@ c_parser_switch_statement (c_parser *parser, bool *if_p)
{ {
switch_cond_loc = UNKNOWN_LOCATION; switch_cond_loc = UNKNOWN_LOCATION;
expr = error_mark_node; expr = error_mark_node;
ce.original_type = error_mark_node;
} }
c_start_case (switch_loc, switch_cond_loc, expr, explicit_cast_p); c_start_case (switch_loc, switch_cond_loc, expr, explicit_cast_p);
save_break = c_break_label; save_break = c_break_label;
......
...@@ -5,6 +5,9 @@ ...@@ -5,6 +5,9 @@
* gcc.dg/c99-flex-array-1.c: Likewise. * gcc.dg/c99-flex-array-1.c: Likewise.
* gcc.dg/c99-flex-array-typedef-1.c: Likewise. * gcc.dg/c99-flex-array-typedef-1.c: Likewise.
PR c/71853
* gcc.dg/noncompile/pr71853.c: New test.
2016-07-29 Uros Bizjak <ubizjak@gmail.com> 2016-07-29 Uros Bizjak <ubizjak@gmail.com>
* gcc.dg/pr59833.c: Use dg-add-options ieee. * gcc.dg/pr59833.c: Use dg-add-options ieee.
......
/* PR c/71853 */
/* { dg-do compile } */
void f (void)
{
case (0) { /* { dg-error "expected" } */
switch 0: { } /* { dg-error "expected" } */
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment