re PR c/20245 (ICE on invalid function declaration)
authorJoseph Myers <joseph@codesourcery.com>
Mon, 28 Feb 2005 19:22:41 +0000 (19:22 +0000)
committerJoseph Myers <jsm28@gcc.gnu.org>
Mon, 28 Feb 2005 19:22:41 +0000 (19:22 +0000)
PR c/20245
* c-parser.c (c_parser_compound_statement): Return error_mark_node
instead of NULL_TREE on error.

testsuite:
* gcc.dg/pr20245-1.c: New test.

From-SVN: r95693

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

index 283128ac7033d7c7d217068bfa96d79b240761c3..db53428e1e290be5460ab44a09c95a085ed890de 100644 (file)
@@ -1,3 +1,9 @@
+2005-02-28  Joseph S. Myers  <joseph@codesourcery.com>
+
+       PR c/20245
+       * c-parser.c (c_parser_compound_statement): Return error_mark_node
+       instead of NULL_TREE on error.
+
 2005-02-28  David Edelsohn  <edelsohn@gnu.org>
 
        * config/rs6000/rs6000.c (EASY_VECTOR_15): Remove.
index adebfd20589067651a9a649acca8641b39069087..de6999a0add40cadd683de15a379747f8ecfe66e 100644 (file)
@@ -3170,7 +3170,7 @@ c_parser_compound_statement (c_parser *parser)
 {
   tree stmt;
   if (!c_parser_require (parser, CPP_OPEN_BRACE, "expected %<{%>"))
-    return NULL_TREE;
+    return error_mark_node;
   stmt = c_begin_compound_stmt (true);
   c_parser_compound_statement_nostart (parser);
   return c_end_compound_stmt (stmt, true);
index 9ed60b0cad467734469c455e0633809c2d530dd6..75fe5325b2559c0f862a556cdc11025fb3dda815 100644 (file)
@@ -1,3 +1,8 @@
+2005-02-28  Joseph S. Myers  <joseph@codesourcery.com>
+
+       PR c/20245
+       * gcc.dg/pr20245-1.c: New test.
+
 2005-02-28  Jakub Jelinek  <jakub@redhat.com>
 
        PR middle-end/19874
diff --git a/gcc/testsuite/gcc.dg/pr20245-1.c b/gcc/testsuite/gcc.dg/pr20245-1.c
new file mode 100644 (file)
index 0000000..51089c6
--- /dev/null
@@ -0,0 +1,5 @@
+/* Bug 20245: the parse error should not result in an ICE.  */
+/* { dg-do compile } */
+/* { dg-options "" } */
+
+void foo() x; /* { dg-error "expected" } */