Bug 28049 - [4.3/4.4/4.5/4.6 regression] ICE on single + or -
Summary: [4.3/4.4/4.5/4.6 regression] ICE on single + or -
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: objc (show other bugs)
Version: 4.2.0
: P5 minor
Target Milestone: 4.6.0
Assignee: Not yet assigned to anyone
URL:
Keywords: error-recovery, ice-on-invalid-code, monitored
Depends on:
Blocks: 23710
  Show dependency treegraph
 
Reported: 2006-06-16 02:04 UTC by Volker Reichelt
Modified: 2010-10-24 10:42 UTC (History)
3 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail: 4.3.3, 4.4.0, 4.5.0
Last reconfirmed: 2009-03-31 21:55:58


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Volker Reichelt 2006-06-16 02:04:07 UTC
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.]
Comment 1 Andrew Pinski 2006-06-17 02:27:28 UTC
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
Comment 2 Andrew Pinski 2006-08-10 08:19:25 UTC
Mark, is there a reason why this is a P2 when this only affects the Objective-C front-end?
Comment 3 Andrew Pinski 2006-08-17 04:51:58 UTC
I have a fix for this, it was casued by the new C parser.
Comment 4 Andrew Pinski 2006-08-17 05:32:13 UTC
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);
 }
Comment 5 Andrew Pinski 2006-08-18 02:23:49 UTC
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.
Comment 6 Andrew Pinski 2006-08-18 02:28:54 UTC
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.
Comment 7 Mark Mitchell 2006-10-16 23:38:39 UTC
In rsponse to Comment #2, no this PR should not be P2.  Downgraded to P5.
Comment 8 Joseph S. Myers 2008-07-04 21:23:31 UTC
Closing 4.1 branch.
Comment 9 Joseph S. Myers 2009-03-31 19:37:25 UTC
Closing 4.2 branch.
Comment 10 Richard Biener 2009-08-04 12:27:48 UTC
GCC 4.3.4 is being released, adjusting target milestone.
Comment 11 Richard Biener 2010-05-22 18:11:08 UTC
GCC 4.3.5 is being released, adjusting target milestone.
Comment 12 Nicola Pero 2010-10-24 10:39:09 UTC
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
Comment 13 Nicola Pero 2010-10-24 10:42:31 UTC
Fixed in trunk, testcases added to trunk.

Thanks