]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c/35444 (ICE with invalid function declaration)
authorJoseph Myers <joseph@codesourcery.com>
Fri, 13 Feb 2009 01:00:24 +0000 (01:00 +0000)
committerJoseph Myers <jsm28@gcc.gnu.org>
Fri, 13 Feb 2009 01:00:24 +0000 (01:00 +0000)
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

gcc/ChangeLog
gcc/c-parser.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/noncompile/pr35444-1.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/noncompile/pr35444-2.c [new file with mode: 0644]

index 6816508903d6b713bff89ae2a6a4de35d59f3c51..92bf954f0b2570ab22d73fe66d3ab3132baa8341 100644 (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.
index 199a5a72f3f7c130fa64e6c576f2afa800a9851a..e09c2c17161b4e1275762ca7a32aad13047f536e 100644 (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;
            }
        }
index 5a940efcd656ff2816ceb184910e5195e7c610d6..986a3619b5f5b4ec7611f2e637ac919f57da5be9 100644 (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
diff --git a/gcc/testsuite/gcc.dg/noncompile/pr35444-1.c b/gcc/testsuite/gcc.dg/noncompile/pr35444-1.c
new file mode 100644 (file)
index 0000000..f855887
--- /dev/null
@@ -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() {}
diff --git a/gcc/testsuite/gcc.dg/noncompile/pr35444-2.c b/gcc/testsuite/gcc.dg/noncompile/pr35444-2.c
new file mode 100644 (file)
index 0000000..43817b9
--- /dev/null
@@ -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() {}