Bug 18408 - [4.0 Regression] ICE compiling code that involves casting classes
Summary: [4.0 Regression] ICE compiling code that involves casting classes
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: objc (show other bugs)
Version: 4.0.0
: P2 normal
Target Milestone: 4.0.0
Assignee: Ziemowit Laski
URL:
Keywords: ice-checking, ice-on-valid-code
: 18771 19553 (view as bug list)
Depends on:
Blocks:
 
Reported: 2004-11-09 22:49 UTC by Marcus Daniels
Modified: 2005-01-25 03:18 UTC (History)
5 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2004-11-27 19:46:20


Attachments
Code that causes ICE to Objective C compiler (252 bytes, text/plain)
2004-11-09 22:51 UTC, Marcus Daniels
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Marcus Daniels 2004-11-09 22:49:14 UTC
This program causes an ICE in today's sources.
Comment 1 Marcus Daniels 2004-11-09 22:51:59 UTC
Created attachment 7506 [details]
Code that causes ICE to Objective C compiler

mgd@arrow[~] $ gcc -v		 
Reading specs from /packages/gcc/lib/gcc/i686-pc-linux-gnu/4.0.0/specs
Configured with: /src/gcc/configure --prefix=/packages/gcc --srcdir=/src/gcc
Thread model: posix
gcc version 4.0.0 20041109 (experimental)

$ gcc in.m -lobjc
in.m: In function '-[ListIndex(linked) _next]':
in.m:35: internal compiler error: in check_pointer_types_r, at gimplify.c:4214
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.

Compare to:
$ gcc -DCAST_TYPE=List in.m -lobjc
Comment 2 Andrew Pinski 2004-11-09 23:16:51 UTC
Confirmed, reduced testcase:
@interface List
{
@public
  int firstLink;
}
@end

@interface ListIndex_linked
{
@public
  List *collection;
  int link;
}
@end

@interface List_linked: List
@end

@implementation List
@end

@implementation ListIndex_linked
- next
{
   link = ((List_linked*)collection)->firstLink;
}
@end
Comment 3 Andrew Pinski 2004-11-09 23:26:00 UTC
This is a recent regression because it was fine with 20041019.
I think it was caused by:
2004-11-02  Ziemowit Laski  <zlaski@apple.com>
        
        * c-lang.c (LANG_HOOKS_TYPES_COMPATIBLE_P): Remove.
        (c_types_compatible_p): Move function definition...
        * c-objc-common.c (c_types_compatible_p): ...here. 
        * c-objc-common.h (LANG_HOOKS_TYPES_COMPATIBLE_P): Moved here from
        c-lang.c.
Comment 4 Ziemowit Laski 2004-11-09 23:34:24 UTC
I'll take a look.
Comment 5 Ziemowit Laski 2004-11-12 01:36:33 UTC
Patch posted here:

    http://gcc.gnu.org/ml/gcc-patches/2004-11/msg00925.html

Awaiting feedback.
Comment 6 Marcus Daniels 2004-11-12 04:27:06 UTC
Fwiw, this does prevent the related ICEs I had..
Comment 7 Andrew Pinski 2004-11-27 19:46:20 UTC
This should not be in waiting (waiting is mainly to get information from the reporter and not other 
developers).
Comment 8 Andrew Pinski 2004-12-02 00:49:41 UTC
*** Bug 18771 has been marked as a duplicate of this bug. ***
Comment 9 Mark Mitchell 2005-01-19 22:46:44 UTC
Objective-C is not part of the release criteria; removing target milestone.
Comment 10 Andrew Pinski 2005-01-19 22:49:03 UTC
(In reply to comment #9)
> Objective-C is not part of the release criteria; removing target milestone.

I should note that this PR blocks building GNUstep with 4.0.0.
Comment 11 Lars Sonchocky-Helldorf 2005-01-20 20:43:36 UTC
(In reply to comment #9)
> Objective-C is not part of the release criteria; removing target milestone.

Mark, allow me to mention that GCC offers the only free Objective-C compiler with modern features 
(like Categories and Exceptions) and is as such the only free Objective-C Compiler available to the 
GNUstep ( http://www.gnustep.org/ ) and swarm ( http://www.swarm.org/ ) folks (The other free 
Objective-C Compiler is POC ( http://users.pandora.be/stes/compiler.html ) which has the problem 
that it's Maintainer David Stes is constantly fighting any additions which would make POC useful for 
other stuff than it's own small class library).

Whoever decides what the release criteria are should put that into consideration. 

regards, Lars
Comment 12 Ziemowit Laski 2005-01-20 21:48:03 UTC
Of course, for this particular bug, someone could just review the patch that I posted two months ago...
Comment 13 Andrew Pinski 2005-01-21 00:15:29 UTC
*** Bug 19553 has been marked as a duplicate of this bug. ***
Comment 14 Andrew Pinski 2005-01-22 15:23:53 UTC
With --disable-checking, we get the correct code but we don't get an ICE.
Comment 15 CVS Commits 2005-01-25 03:13:19 UTC
Subject: Bug 18408

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	pinskia@gcc.gnu.org	2005-01-25 03:13:11

Modified files:
	gcc/objc       : ChangeLog objc-act.c objc-act.h objc-lang.c 

Log message:
	2005-01-25  Alexander Malmberg  <alexander@malmberg.org>
	
	PR objc/18408
	* objc-act.c (objc_types_compatible_p): New function.
	* objc-act.h (objc_types_compatible_p): Declare.
	* objc-lang.c (LANG_HOOKS_TYPES_COMPATIBLE_P): Define.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/objc/ChangeLog.diff?cvsroot=gcc&r1=1.25&r2=1.26
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/objc/objc-act.c.diff?cvsroot=gcc&r1=1.262&r2=1.263
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/objc/objc-act.h.diff?cvsroot=gcc&r1=1.33&r2=1.34
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/objc/objc-lang.c.diff?cvsroot=gcc&r1=1.52&r2=1.53

Comment 16 CVS Commits 2005-01-25 03:16:53 UTC
Subject: Bug 18408

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	pinskia@gcc.gnu.org	2005-01-25 03:16:48

Modified files:
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/objc.dg: comp-types-7.m 

Log message:
	2005-01-25  Alexander Malmberg  <alexander@malmberg.org>
	
	PR objc/18408
	* objc.dg/comp-types-7.m: New test.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.4933&r2=1.4934
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/objc.dg/comp-types-7.m.diff?cvsroot=gcc&r1=1.1&r2=1.2

Comment 17 Andrew Pinski 2005-01-25 03:18:26 UTC
Fixed.