PR c/29062
* c-parser.c (c_parser_statement_after_labels): Error if a
declaration is parsed after a label.
testsuite/
* gcc.dg/
20031223-1.c: Adjust error output.
* gcc.dg/parse-decl-after-label.c: New.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@129873
138bc75d-0d04-0410-961f-
82ee72b054a4
+2007-11-03 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
+
+ PR c/29062
+ * c-parser.c (c_parser_statement_after_labels): Error if a
+ declaration is parsed after a label.
+
2007-11-03 Daniel Jacobowitz <dan@codesourcery.com>
PR debug/33921
break;
default:
expr_stmt:
+ if (c_parser_next_token_starts_declspecs (parser))
+ {
+ error ("a label can only be part of a statement and a declaration is not a statement");
+ c_parser_declaration_or_fndef (parser, /*fndef_ok*/ false,
+ /*nested*/ true, /*empty_ok*/ false,
+ /*start_attr_ok*/ true);
+ return;
+ }
stmt = c_finish_expr_stmt (c_parser_expression_conv (parser).value);
expect_semicolon:
c_parser_skip_until_found (parser, CPP_SEMICOLON, "expected %<;%>");
+2007-11-03 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
+
+ PR c/29062
+ * gcc.dg/20031223-1.c: Adjust error output.
+ * gcc.dg/parse-decl-after-label.c: New.
+
2007-11-03 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR libfortran/24685
void f ()
{
- l: int; /* { dg-error "" } */
+ l: int; /* { dg-error "a label can only be part of a statement and a declaration is not a statement" } */
+ /* { dg-warning "useless type name in empty declaration" "" { target *-*-* } 10 } */
}
--- /dev/null
+/* PR 29062
+{ dg-do compile }
+{ dg-options "-fsyntax-only" }
+*/
+
+int f(x)
+{
+ if (x > 1)
+ {
+ goto finish;
+ }
+ return x;
+
+ finish:
+ int ret = 1; /* { dg-error "a label can only be part of a statement and a declaration is not a statement" } */
+ return ret;
+}