re PR c/35444 (ICE with invalid function declaration)

PR c/35444
	* c-parser.c (c_parser_parms_list_declarator): Discard pending
	sizes on syntax error after some arguments have been parsed.

testsuite:
	* gcc.dg/noncompile/pr35444-1.c, gcc.dg/noncompile/pr35444-2.c:
	New tests.

From-SVN: r144149
This commit is contained in:
Joseph Myers 2009-02-13 01:00:24 +00:00 committed by Joseph Myers
parent f3eb9681f0
commit f007042e20
5 changed files with 21 additions and 0 deletions

View File

@ -1,3 +1,9 @@
2009-02-13 Joseph Myers <joseph@codesourcery.com>
PR c/35444
* c-parser.c (c_parser_parms_list_declarator): Discard pending
sizes on syntax error after some arguments have been parsed.
2009-02-12 Jakub Jelinek <jakub@redhat.com>
* doc/invoke.texi (-fira): Remove.

View File

@ -2578,6 +2578,7 @@ c_parser_parms_list_declarator (c_parser *parser, tree attrs)
"expected %<;%>, %<,%> or %<)%>"))
{
c_parser_skip_until_found (parser, CPP_CLOSE_PAREN, NULL);
get_pending_sizes ();
return NULL;
}
if (c_parser_next_token_is (parser, CPP_ELLIPSIS))
@ -2605,6 +2606,7 @@ c_parser_parms_list_declarator (c_parser *parser, tree attrs)
{
c_parser_skip_until_found (parser, CPP_CLOSE_PAREN,
"expected %<)%>");
get_pending_sizes ();
return NULL;
}
}

View File

@ -1,3 +1,9 @@
2009-02-13 Joseph Myers <joseph@codesourcery.com>
PR c/35444
* gcc.dg/noncompile/pr35444-1.c, gcc.dg/noncompile/pr35444-2.c:
New tests.
2009-02-12 Jason Merrill <jason@redhat.com>
PR c++/38950

View File

@ -0,0 +1,3 @@
/* PR 35444: ICE from pending VLA sizes in invalid parameter list. */
void foo(int n, int a[n], int 0); /* { dg-error "expected" } */
void bar() {}

View File

@ -0,0 +1,4 @@
/* PR 35444: ICE from pending VLA sizes in invalid parameter list.
Similar case to the PR, but with "..." before the syntax error. */
void foo(int n, int a[n], ... 0); /* { dg-error "expected" } */
void bar() {}