This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[patch, PR28050] Fix ICE on invalid initializer
- From: Matthias Klose <doko at ubuntu dot com>
- To: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Mon, 22 Jun 2009 13:17:41 +0200
- Subject: [patch, PR28050] Fix ICE on invalid initializer
Patch taken from the bug report, the C part is approved in the bug report. No
regressions on i686-linux on the trunk. Of for the trunk? Ok for the branch
after testing succeeds?
Matthias
gcc/
PR objc/28050
* c-parser.c (c_parser_objc_message_args): Return error_mark_node
instead of NULL if a parser error occurs.
objc/
PR objc/28050
* objc-act.c (objc_build_message_args): Return if ARGS is the
error_mark_node.
gcc/testsuite
PR objc/28050
* pr28050.m: New testcase.
Index: gcc/objc/objc-act.c
===================================================================
--- gcc/objc/objc-act.c (revision 148783)
+++ gcc/objc/objc-act.c (working copy)
@@ -6268,7 +6268,8 @@
#endif
tree method_params = NULL_TREE;
- if (TREE_CODE (receiver) == ERROR_MARK)
+ if (TREE_CODE (receiver) == ERROR_MARK
+ || TREE_CODE (args) == ERROR_MARK)
return error_mark_node;
if (CAN_HAVE_LOCATION_P (receiver))
Index: gcc/testsuite/objc.dg/pr28050.m
===================================================================
--- gcc/testsuite/objc.dg/pr28050.m (revision 0)
+++ gcc/testsuite/objc.dg/pr28050.m (revision 0)
@@ -0,0 +1,2 @@
+/* { dg-do compile } */
+int i = [0]; /* { dg-error "expected .:. before .\\]. token" } */
Index: gcc/c-parser.c
===================================================================
--- gcc/c-parser.c (revision 148783)
+++ gcc/c-parser.c (working copy)
@@ -6818,7 +6818,7 @@
{
tree keywordexpr;
if (!c_parser_require (parser, CPP_COLON, "expected %<:%>"))
- return list;
+ return error_mark_node;
keywordexpr = c_parser_objc_keywordexpr (parser);
list = chainon (list, build_tree_list (sel, keywordexpr));
sel = c_parser_objc_selector (parser);