The following invalid code snippet causes an ICE since GCC 4.1.0: ====================== + ====================== bug.m:1: error: expected ':' at end of input bug.m:1: internal compiler error: Segmentation fault Please submit a full bug report, [etc.]
A single minus have the same ICE and backtrace: #0 0x000000000040c33f in build_method_decl (code=167, ret_type=0x2aaaaaf3b8d0, selector=0x0, add_args=0x2aaaaaf3b8a0, ellipsis=0 '\0') at /home/pinskia/src/gcc-4.1/gcc/gcc/objc/objc-act.c:5952 #1 0x0000000000402fff in objc_build_method_signature (rettype=0x0, selector=0x0, optparms=0x2aaaaaf3b8a0, ellipsis=0 '\0') at /home/pinskia/src/gcc-4.1/gcc/gcc/objc/objc-act.c:731 #2 0x00000000004740fd in c_parser_objc_method_decl (parser=0x2aaaaae03410) at /home/pinskia/src/gcc-4.1/gcc/gcc/c-parser.c:5900 #3 0x0000000000473d2f in c_parser_objc_method_definition (parser=0x2aaaaae03410) at /home/pinskia/src/gcc-4.1/gcc/gcc/c-parser.c:5720
Mark, is there a reason why this is a P2 when this only affects the Objective-C front-end?
I have a fix for this, it was casued by the new C parser.
Here is the patch which I am testing: Index: c-parser.c =================================================================== --- c-parser.c (revision 116204) +++ c-parser.c (working copy) @@ -6149,7 +6149,10 @@ c_parser_objc_method_decl (c_parser *par parms = chainon (parms, build_tree_list (NULL_TREE, grokparm (parm))); } - sel = list; + if (list) + sel = list; + else + sel = error_mark_node; } return objc_build_method_signature (type, sel, parms, ellipsis); }
Actually I am going to implement the fix better, we really should be even calling c_parser_objc_method_decl at the toplevel of parsing. I think it was implemented this way because the old bison based parser did that. Very much related to PR 23710. The only issue now is that the correct way of fixing this will almost certain require a copyright assignment ...... which is a problem.
Actually no I am not going to fix this. Because it means I have to do a partical rewrite on how c_parser_external_declaration is done for objc and I am not going to do it.
In rsponse to Comment #2, no this PR should not be P2. Downgraded to P5.
Closing 4.1 branch.
Closing 4.2 branch.
GCC 4.3.4 is being released, adjusting target milestone.
GCC 4.3.5 is being released, adjusting target milestone.
Author: nicola Date: Sun Oct 24 10:39:05 2010 New Revision: 165898 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=165898 Log: In gcc/testsuite/: 2010-10-24 Nicola Pero <nicola.pero@meta-innovation.com> PR objc/24393 * objc.dg/pr24393.m: New. * obj-c++.dg/pr24393.mm: New. 2010-10-24 Nicola Pero <nicola.pero@meta-innovation.com> PR objc/28049 * objc.dg/pr28049.m: New. * obj-c++.dg/pr28049.mm: New. Added: trunk/gcc/testsuite/obj-c++.dg/pr24393.mm trunk/gcc/testsuite/obj-c++.dg/pr28049.mm trunk/gcc/testsuite/objc.dg/pr24393.m trunk/gcc/testsuite/objc.dg/pr28049.m Modified: trunk/gcc/testsuite/ChangeLog
Fixed in trunk, testcases added to trunk. Thanks