]> 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 13:10:52 +0000 (13:10 +0000)
committerJoseph Myers <jsm28@gcc.gnu.org>
Fri, 13 Feb 2009 13:10:52 +0000 (13:10 +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: r144155

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 779b481729b2d1e4ff8acc5430bce836cc826254..bcfb24c4b2b95fb7bf23e501f9e32b34e8c8a53f 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-11  Uros Bizjak  <ubizjak@gmail.com>
            Jakub Jelinek  <jakub@redhat.com>
 
index 59f75b0cc874ed447164c38a487970e19472fbeb..f0e17952b12c04839363f9d9e8ccd7611b968288 100644 (file)
@@ -2680,6 +2680,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))
@@ -2707,6 +2708,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 bac683f8a25ad5ab18dd17d7828bd6e2b3704064..288e79e9951a43f520cb789c6ae9a38b663b1305 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-10  Steve Ellcey  <sje@cup.hp.com>
 
        PR c/39084
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() {}