Bug 10017 - [3.2/3.3/3.4 regression] ICE: unable to find a register to spill in class `GENERAL_REGS'
Summary: [3.2/3.3/3.4 regression] ICE: unable to find a register to spill in class `GE...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: rtl-optimization (show other bugs)
Version: 3.2.2
: P3 normal
Target Milestone: ---
Assignee: Richard Henderson
URL:
Keywords: ice-on-invalid-code
Depends on:
Blocks:
 
Reported: 2003-03-10 15:36 UTC by qboosh
Modified: 2004-01-17 04:22 UTC (History)
5 users (show)

See Also:
Host: i686-pld-linux-gnu
Target: i686-pld-linux-gnu
Build: i686-pld-linux-gnu
Known to work:
Known to fail:
Last reconfirmed:


Attachments
cvm.i.bz2 (39.18 KB, application/octet-stream)
2003-05-21 15:17 UTC, qboosh
Details

Note You need to log in before you can comment on or make changes to this bug.
Description qboosh 2003-03-10 15:36:01 UTC
When trying to compile pnet 0.5.2 with CFLAGS set to "-O2 -march=i686" or
"-O2 -march=athlon", gcc shows ICE on file engine/cvm.c. pnet's configure
script adds -fno-gsce to CFLAGS - and that seems to trigger the ICE.
Here is compiler command line and output:

  if i686-pld-linux-gcc -DHAVE_CONFIG_H -I. -I. -I../include    -I../libffi/include -fno-gcse -fno-inline-functions -I../include -I../libffi/include -I. -O2 -march=i686 -Wall -MT cvm.o -MD -MP -MF ".deps/cvm.Tpo" \
    -c -o cvm.o `test -f 'cvm.c' || echo './'`cvm.c; \
  then mv ".deps/cvm.Tpo" ".deps/cvm.Po"; \
  else rm -f ".deps/cvm.Tpo"; exit 1; \
  fi
  cvm.c: In function `_ILCVMInterpreter':
  cvm.c:684: unable to find a register to spill in class `GENERAL_REGS'
  cvm.c:684: this is the insn:
  (insn 4757 4756 4758 (parallel[
              (set (reg/v:DI 1826)
                  (ashift:DI (reg/v:DI 1826)
                      (subreg:QI (reg:SI 1828) 0)))
              (clobber (scratch:SI))
              (clobber (reg:CC 17 flags))
          ] ) 405 {ashldi3_1} (insn_list 4753 (insn_list 4756 (nil)))
      (expr_list:REG_DEAD (reg:SI 1828)
          (expr_list:REG_UNUSED (scratch:SI)
              (expr_list:REG_UNUSED (reg:CC 17 flags)
                  (nil)))))
  cvm.c:684: confused by earlier errors, bailing out
  make: *** [cvm.o] Error 1

Release:
3.2.2 (PLD Linux)

Environment:
System: Linux builder 2.4.18 #1 Thu Nov 14 13:18:42 UTC 2002 i686 unknown unknown PLD Linux
Architecture: i686
	(Athlon CPU, Linux 2.4.18, glibc 2.3.1)
host: i686-pld-linux-gnu
build: i686-pld-linux-gnu
target: i686-pld-linux-gnu
configured with: ../configure --prefix=/usr --infodir=/usr/share/info --mandir=/usr/share/man --enable-shared --enable-threads=posix --enable-__cxa_atexit --enable-languages=c,c++,f77,gcov,objc,ksi,ada,java --enable-c99 --enable-long-long --enable-multilib --enable-nls --with-gnu-as --with-gnu-ld --with-system-zlib --with-slibdir=/lib --without-x i686-pld-linux

How-To-Repeat:
Compile cvm.i with one of:
-O2 -march=athlon -fno-gcse
-O2 -march=i686 -fno-gcse

or:
-O1 -march=athlon
-O1 -march=i686
-O0 -march=athlon
-O0 -march=i686
(with -O1 or -O0 ICE message differs a little)
Comment 1 qboosh 2003-03-10 15:36:01 UTC
Fix:
I don't known how to fix (I'm not familiar with gcc internals).
Possible workarounds (optimizations which don't trigger ICE):

-O2 -march=i[345]86 -fno-gcse
-O2 -march={i686|athlon}
-O1 -march=i[345]86
-O1 -march={i686|athlon} -fgcse
-O0 -march=i[345]86
Comment 2 Volker Reichelt 2003-03-10 16:38:13 UTC
State-Changed-From-To: open->analyzed
State-Changed-Why: Confirmed.
    
    The code crashes every compiler since gcc 2.95.x.
    (I get a tree checking error with gcc 2.95.x and
    a no register to spill sinc 3.0).
    
    I'll try to come up with a reduced example.
Comment 3 Volker Reichelt 2003-03-10 22:04:33 UTC
From: Volker Reichelt <reichelt@igpm.rwth-aachen.de>
To: gcc-gnats@gcc.gnu.org, gcc-bugs@gcc.gnu.org, qboosh@pld.org.pl
Cc:  
Subject: Re: optimization/10017: [3.2/3.3/3.4 regression] ICE: unable to find a
 register to spill in class `GENERAL_REGS'
Date: Mon, 10 Mar 2003 22:04:33 +0100 (CET)

 Here's a reduced testcase:
 
 ---------------------------------snip here---------------------------
 void      foo (long long i);
 long long bar (int *p);
 
 void baz()
 {
     static void *array[2] = { &&L0, &&L1 };
 
     register void *p asm ("esi");
     register int *q asm ("edi");
     register int *r asm ("ebx");
 
     for(;;)
     {
         L0: *q = *r; goto *p;
         L1: foo(bar(q) << *q);
     }
 }
 ---------------------------------snip here---------------------------
 
 It crashes every compiler version since 3.0, but compiles fine with gcc 2.95.x.
 (Just compile with "gcc -march=i686 -c".)
 
 (The problems with gcc 2.95.x concerning the original example seem to be a
 different issue.) Therefore, I rate this as a regression.
 
 The bug category is probably wrong, perhaps it is a middle-end bug
 or even inline-asm since the register variable have "asm" attached.
 Could somebody with more insight change the categeory?
 
 Regards,
 Volker
 
 http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=10017
 
 

Comment 4 s.bosscher 2003-03-25 09:32:50 UTC
From: Steven Bosscher <s.bosscher@student.tudelft.nl>
To: gcc-gnats@gcc.gnu.org, gcc-bugs@gcc.gnu.org, qboosh@pld.org.pl,
	nobody@gcc.gnu.org, gcc-prs@gcc.gnu.org
Cc:  
Subject: Re: optimization/10017: [3.2/3.3/3.4 regression] ICE: unable to find
 a register to spill in class `GENERAL_REGS'
Date: Tue, 25 Mar 2003 09:32:50 +0100

 http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=10017
 
 May be related to PR 9929.  The proposed fix
 there doesn't fix this problem though.
 
 Greetz
 Steven
 
 

Comment 5 janis187 2003-03-25 11:44:56 UTC
From: Janis Johnson <janis187@us.ibm.com>
To: gcc-gnats@gcc.gnu.org, gcc-bugs@gcc.gnu.org, qboosh@pld.org.pl,
   nobody@gcc.gnu.org, gcc-prs@gcc.gnu.org
Cc:  
Subject: Re: optimization/10017: [3.2/3.3/3.4 regression] ICE: unable to find a 
 register to spill in class `GENERAL_REGS'
Date: Tue, 25 Mar 2003 11:44:56 -0800

 This is the patch that introduced the regression (yeah, I know,
 this information probably isn't the least bit useful):
 
 Wed Sep  1 21:13:48 1999  Richard Henderson  <rth@cygnus.com>
 
         Merge new ia32 backend from the branch!
 
         * i386.h, i386.c, i386.md, reg-stack.c, i386/unix.h: Many
 changes.
         See ChangeLog.P2 on new_ia32_branch for details.
 
         * rtl.h (stack_regs_mentioned_p): Delete prototype.
         * i386/cygwin.h (SUBTARGET_PROLOGUE): No more do_rtl.
         * i386/win32.h (SUBTARGET_PROLOGUE): Likewise.
         * i386/gas.h (ASM_FILE_START): Define.
         * i386/winnt.c (i386_pe_valid_decl_attribute_p): Update
         for name change of ix86_valid_decl_attribute_p.
         (i386_pe_valid_type_attribute_p): Similarly.
 
 The hunt used Volker's reduced testcase with -march=i686 on
 i686-pc-linux-gnu.
 
 http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=10017
 
 
 
Comment 6 Mark Mitchell 2003-03-31 20:34:33 UTC
State-Changed-From-To: analyzed->closed
State-Changed-Why: Not a bug.
Comment 7 Richard Henderson 2003-03-31 21:10:49 UTC
Responsible-Changed-From-To: unassigned->rth
Responsible-Changed-Why: Analysis for the "not a bug" result:
    http://gcc.gnu.org/ml/gcc-patches/2003-03/msg02568.html