Bug 12017 - ICE: in spill_failure, at reload1.c:1862 with builtin_apply/builtin_return
Summary: ICE: in spill_failure, at reload1.c:1862 with builtin_apply/builtin_return
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 3.4.0
: P2 normal
Target Milestone: 4.2.1
Assignee: Not yet assigned to anyone
URL:
Keywords: build, ice-on-valid-code
Depends on:
Blocks:
 
Reported: 2003-08-21 19:05 UTC by Dara Hazeghi
Modified: 2007-09-04 03:46 UTC (History)
5 users (show)

See Also:
Host:
Target: avr
Build:
Known to work: 4.3.0 4.2.1
Known to fail:
Last reconfirmed: 2005-02-12 23:28:10


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dara Hazeghi 2003-08-21 19:05:12 UTC
Building gcc mainline for avr target ICEs when building libobjc:

/home/dara/mainline/objdir/gcc/xgcc -B/home/dara/mainline/objdir/gcc/ -nostdinc -B/home/
dara/mainline/objdir/avr/newlib/ -isystem /home/dara/mainline/objdir/avr/newlib/targ-include 
-isystem /home/dara/mainline/combined/newlib/libc/include -B/tmp//avr/bin/ -B/tmp//avr/lib/ 
-isystem /tmp//avr/include -isystem /tmp//avr/sys-include -L/home/dara/mainline/objdir/ld -c 
-I. -I/home/dara/mainline/combined/libobjc -O2 -g -O2 -W -Wall -Wwrite-strings -Wstrict-
prototypes -DIN_GCC -DIN_TARGET_LIBS -I/home/dara/mainline/combined/libobjc/objc -I/
home/dara/mainline/combined/libobjc/../gcc -I/home/dara/mainline/combined/libobjc/../gcc/
config -I../../gcc -I/home/dara/mainline/combined/libobjc/../include /home/dara/mainline/
combined/libobjc/sendmsg.c -o sendmsg.o
/home/dara/mainline/combined/libobjc/sendmsg.c:42:1: warning: "rtx" redefined
In file included from /home/dara/mainline/combined/libobjc/sendmsg.c:31:
/home/dara/mainline/combined/libobjc/../gcc/coretypes.h:58:1: warning: this is the location of 
the previous definition
/home/dara/mainline/combined/libobjc/sendmsg.c: In function `__objc_word_forward':

/home/dara/mainline/combined/libobjc/sendmsg.c:581: error: unable to find a register to spill in 
class `BASE_POINTER_REGS'
/home/dara/mainline/combined/libobjc/sendmsg.c:581: error: this is the insn:
(insn 49 48 50 1 /home/dara/mainline/combined/libobjc/sendmsg.c:578 (set (reg:QI 30 r30 [+6 
])
        (mem:QI (plus:HI (reg/v/f:HI 18 r18 [orig:45 res ] [45])
                (const_int 6 [0x6])) [0 S1 A8])) 9 {*movqi} (nil)
    (nil))
/home/dara/mainline/combined/libobjc/sendmsg.c:581: internal compiler error: in spill_failure, at 
reload1.c:1862
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.
make: *** [sendmsg.lo] Error 1

Here's a testcase:

typedef const struct objc_selector
{
  void *sel_id;
  const char *sel_types;
} *SEL;

typedef struct objc_object {
  struct objc_class* class_pointer;
} *id;

static id
__objc_word_forward (id rcv, SEL op, ...)
{
  void *args, *res;

  args = __builtin_apply_args ();
  res = __objc_forward (rcv, op, args);
  __builtin_return (res);
}

This reproduces the ICE with a cross cc1. No optimization flags are necessary.
Comment 1 Eric Weddington 2003-10-01 21:46:13 UTC
The only known languages that builds for the AVR are C and C++. There has been 
work on an Ada port for the AVR here: <http://sourceforge.net/projects/avr-
ada>, but it is incomplete. Any others (such as Objective C) on the AVR are 
unknown.

Newlib is not used as the C library for the AVR. You need to get avr-libc: 
<http://savannah.nongnu.org/projects/avr-libc>

The avr-libc user manual (found online above) also has instructions on building 
and installing a full toolchain. The AVR toolchain is maintained on Linux, 
FreeBSD, and Windows, and is known to build on Solaris and recently Mac OSX. 
For the Windows port see WinAVR: <http://sourceforge.net/projects/winavr>. For 
information on OSX see recent posts to the avr-gcc-list mailing list: 
<http://www.avr1.org/mailman/listinfo/avr-gcc-list/>

Eric
Comment 2 Andrew Pinski 2003-10-01 21:49:32 UTC
Confirmed on the mainline (20030930).
Comment 3 Andrew Pinski 2003-10-01 21:49:53 UTC
Suspending as there is no avr maintainer, yet.
Comment 4 Eric Weddington 2003-10-01 21:54:52 UTC
There are 2 AVR maintainers.
From the MAINTAINERS file (3.3.1):
avr port		Denis Chertykov		denisc@overta.ru
avr port		Marek Michalkiewicz	marekm@linux.org.pl
Comment 5 Andrew Pinski 2003-10-01 21:58:36 UTC
Woops that was a different target I was think of.
Comment 6 Andrew Pinski 2003-10-01 22:03:51 UTC
Note this is C code not Objective-C code any way.
Comment 7 Dara Hazeghi 2003-10-24 17:40:21 UTC
This problem is still present on mainline.

Denis, do you have any suggestions about what may be causing this issue? Thanks.
Comment 8 denisc 2003-10-27 20:30:30 UTC
Subject: Re:  libobjc/sendmsg.c build ICE: in spill_failure, at reload1.c:1862

"dhazeghi at yahoo dot com" <gcc-bugzilla@gcc.gnu.org> writes:

It's because __builtin_return completely unsupported.

Denis.

Comment 9 Dara Hazeghi 2003-10-27 21:38:50 UTC
Fair enough. Then would it be possible to disable building of objc (and libobjc) on avr in configure, 
and document this as such? If this sounds good, I can make a patch...
Comment 10 denisc 2003-10-30 17:53:09 UTC
Subject: Re:  libobjc/sendmsg.c build ICE: in spill_failure, at reload1.c:1862

"dhazeghi at yahoo dot com" <gcc-bugzilla@gcc.gnu.org> writes:

> PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
> 
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12017
> 
> 
> 
> ------- Additional Comments From dhazeghi at yahoo dot com  2003-10-27 21:38 -------
> Fair enough. Then would it be possible to disable building of objc (and libobjc) on avr in configure, 
> and document this as such? If this sounds good, I can make a
> patch...

Please make it !

Denis.

Comment 11 Andrew Pinski 2003-12-29 04:54:53 UTC
Note the Objective-C front-end just produces C front-end trees so the problem is in avr 
back-end and needs to be fixed, this bug also is when using the C source code and not 
Objective-C source.
So this really needs to be fixed and not patched by not building libobjc.
Comment 12 Eric Weddington 2007-08-23 22:26:36 UTC
Seems to be fixed in 4.3 20070817 snapshot.

An additional minor patch is needed, not for this bug, but to allow Objective-C to build for the AVR. (It's unknown if Objective-C will actually *work* on the AVR...)

--- gcc/config/avr/avr.h.old	2007-08-23 15:18:31.015625000 -0600
+++ gcc/config/avr/avr.h	2007-08-23 15:19:17.687500000 -0600
@@ -53,7 +53,7 @@ extern int avr_mega_p;
 extern int avr_have_mul_p;
 extern int avr_asm_only_p;
 extern int avr_have_movw_lpmx_p;
-#ifndef IN_LIBGCC2
+#if !defined(IN_LIBGCC2) && !defined(IN_TARGET_LIBS)
 extern GTY(()) section *progmem_section;
 #endif
 
Comment 13 Eric Weddington 2007-09-04 03:46:02 UTC
Seems to be fixed in 4.2.1, at least. I haven't tried earlier releases. Changing target milestone and closing bug.