From: Jakub Jelinek Date: Fri, 24 Aug 2012 21:45:22 +0000 (+0200) Subject: re PR c/54355 (ICE on invalid code in switch statement) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=6265d07ce0d8cdbfba7d3057804441d1a14f5b73;p=gcc.git re PR c/54355 (ICE on invalid code in switch statement) PR c/54355 * c-decl.c (c_parser_label): Pass true as nested and fix up comments for nested and empty_ok arguments in the call to c_parser_declaration_or_fndef. * gcc.dg/pr54355.c: New test. From-SVN: r190656 --- diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog index 72b5a4d3aa2..108c0d316f1 100644 --- a/gcc/c/ChangeLog +++ b/gcc/c/ChangeLog @@ -1,3 +1,10 @@ +2012-08-24 Jakub Jelinek + + PR c/54355 + * c-decl.c (c_parser_label): Pass true as nested and fix up comments + for nested and empty_ok arguments in the call to + c_parser_declaration_or_fndef. + 2012-08-17 Jakub Jelinek * c-tree.h (c_last_sizeof_arg): Declare. diff --git a/gcc/c/c-parser.c b/gcc/c/c-parser.c index 7536dc56f05..bea9791925c 100644 --- a/gcc/c/c-parser.c +++ b/gcc/c/c-parser.c @@ -4327,7 +4327,7 @@ c_parser_label (c_parser *parser) "a declaration is not a statement"); c_parser_declaration_or_fndef (parser, /*fndef_ok*/ false, /*static_assert_ok*/ true, - /*nested*/ true, /*empty_ok*/ false, + /*empty_ok*/ true, /*nested*/ true, /*start_attr_ok*/ true, NULL); } } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index e217cd58fdd..6fa07551138 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2012-08-24 Jakub Jelinek + + PR c/54355 + * gcc.dg/pr54355.c: New test. + 2012-08-24 H.J. Lu PR debug/52857 diff --git a/gcc/testsuite/gcc.dg/pr54355.c b/gcc/testsuite/gcc.dg/pr54355.c new file mode 100644 index 00000000000..0a0b7fa970e --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr54355.c @@ -0,0 +1,11 @@ +/* PR c/54355 */ +/* { dg-do compile } */ + +void +foo (int i) +{ + switch (i) + { + case 0: T x > /* { dg-error "(label|unknown type|expected)" } */ + } +} /* { dg-error "expected" } */