Bug 9085 - Unable to find register to spill when optimizing
Summary: Unable to find register to spill when optimizing
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: rtl-optimization (show other bugs)
Version: 3.2
: P3 normal
Target Milestone: 4.5.0
Assignee: Not yet assigned to anyone
URL:
Keywords: ice-on-valid-code, monitored, ra
: 13565 31508 (view as bug list)
Depends on:
Blocks: 15464 28019 32647
  Show dependency treegraph
 
Reported: 2002-12-28 13:46 UTC by j.vanbemmel
Modified: 2009-11-09 22:13 UTC (History)
6 users (show)

See Also:
Host:
Target: i?86-pc-linuc-gnu
Build:
Known to work:
Known to fail: 2.95 3.2 3.3.5 3.4.4
Last reconfirmed: 2006-09-17 07:48:30


Attachments
9085.cpp (599 bytes, text/x-c )
2003-05-21 15:17 UTC, j.vanbemmel
Details

Note You need to log in before you can comment on or make changes to this bug.
Description j.vanbemmel 2002-12-28 13:46:01 UTC
Compiler says "unable to find a register to spill in class `AREG'" for attached code when compiled with following flags:
-c -Os -mregparm=2 -fschedule-insns -march=k6

(it works when any of these flags are omitted)

Release:
gcc version 3.2 20020927 (prerelease)

Environment:
cygwin with latest GCC port, perhaps also others

How-To-Repeat:
gcc -c -Os -mregparm=2 -fschedule-insns -march=k6 try.cpp
Comment 1 Paolo Carlini 2002-12-28 13:49:55 UTC
State-Changed-From-To: open->feedback
State-Changed-Why: For some reason, the attachment got lost. Could you possibly
    provide it again?
    Thanks, Paolo.
Comment 2 Paolo Carlini 2002-12-28 14:08:48 UTC
State-Changed-From-To: feedback->open
State-Changed-Why: Attachment received.
Comment 3 j.vanbemmel 2002-12-28 22:59:12 UTC
From: "Jeroen van Bemmel" <j.vanbemmel@home.nl>
To: <j.vanbemmel@home.nl>,
	<gcc-gnats@gcc.gnu.org>,
	<gcc-prs@gcc.gnu.org>,
	<gcc-bugs@gcc.gnu.org>,
	<nobody@gcc.gnu.org>
Cc:  
Subject: Re: optimization/9085: gcc 3.2 unable to find register to spill when optimizing
Date: Sat, 28 Dec 2002 22:59:12 +0100

 This is a multi-part message in MIME format.
 
 ------=_NextPart_000_01F0_01C2AEC4.BCE236C0
 Content-Type: text/plain;
 	charset="iso-8859-1"
 Content-Transfer-Encoding: quoted-printable
 
 All,
 
 I noticed the attachment was missing, so I created another report with =
 the missing data.
 Sorry for the inconvenience
 
 What probably caused it, was that I forgot to set Submitter-Id. I had to =
 re-submit the report, and
 failed to notice that the attachement was reset. The webpage should =
 remember it...
 
 http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=3Dview%20audit-trail&database=3D=
 gcc&pr=3D9085
 ------=_NextPart_000_01F0_01C2AEC4.BCE236C0
 Content-Type: text/html;
 	charset="iso-8859-1"
 Content-Transfer-Encoding: quoted-printable
 
 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
 <HTML><HEAD>
 <META http-equiv=3DContent-Type content=3D"text/html; =
 charset=3Diso-8859-1">
 <META content=3D"MSHTML 6.00.2800.1126" name=3DGENERATOR>
 <STYLE></STYLE>
 </HEAD>
 <BODY bgColor=3D#ffffff>
 <DIV><FONT face=3DArial size=3D2>All,</FONT></DIV>
 <DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
 <DIV><FONT face=3DArial size=3D2>I noticed the attachment was missing, =
 so I created=20
 another report with the missing data.</FONT></DIV>
 <DIV><FONT face=3DArial size=3D2>Sorry for the =
 inconvenience</FONT></DIV>
 <DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
 <DIV><FONT face=3DArial size=3D2>What probably caused it, was that I =
 forgot to set=20
 Submitter-Id. I had to re-submit the report, and</FONT></DIV>
 <DIV><FONT face=3DArial size=3D2>failed to notice that the attachement =
 was reset.=20
 The webpage should remember it...</FONT></DIV>
 <DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV><A=20
 href=3D"http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=3Dview%20audit-trail&a=
 mp;database=3Dgcc&amp;pr=3D9085">http://gcc.gnu.org/cgi-bin/gnatsweb.pl?c=
 md=3Dview%20audit-trail&amp;database=3Dgcc&amp;pr=3D9085</A></BODY></HTML=
 >
 
 ------=_NextPart_000_01F0_01C2AEC4.BCE236C0--
 
Comment 4 Volker Reichelt 2003-01-06 04:06:53 UTC
State-Changed-From-To: open->analyzed
State-Changed-Why: Confirmed (on i686-pc-linux-gnu).
    
    A cleaned-up testcase is the following:
    
    ------------------------snip here------------------------
    struct A
    {
        unsigned char c;
        int i, j;
    
        void foo (unsigned, unsigned, unsigned);
    };
    
    void A::foo (unsigned c0, unsigned i0, unsigned j0)
    {
        c = c0%3;
        i = i0;
        j = j0;
    }
    ------------------------snip here------------------------
    
    The bug is present since at least gcc 2.95.x and is still
    present in the 3.3 branch and mainline (3.4 20021230).
Comment 5 Dara Hazeghi 2003-05-09 22:04:54 UTC
From: Dara Hazeghi <dhazeghi@yahoo.com>
To: gcc-gnats@gcc.gnu.org
Cc:  
Subject: Re: optimization/9085: gcc 3.2 unable to find register to spill when optimizing
Date: Fri, 9 May 2003 22:04:54 -0700

 http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit- 
 trail&database=gcc&pr=9085
 
 Confirmed on gcc 3.2.3, 3.3 branch and mainline (20030509).
 
 Dara
Comment 6 Andrew Pinski 2003-08-18 02:38:17 UTC
You only need: gcc -Os -mregparm=2 pr9085.cc -fschedule-insns
It happens on most arch's.
Comment 7 Serge Belyshev 2005-01-12 02:31:19 UTC
// C testcase, use '-O1 -mregparm=1 -fschedule-insns -march=i386':

struct A
{
  int j;
};

void foo (struct A *p, int j)
{
  p->j = j % 3;
}

Introduced by this change:

Tue Oct 27 23:32:34 1998  Bernd Schmidt <crux@pool.informatik.rwth-aachen.de>

	* reload.h (struct insn_chain): Add need_operand_change element.
	* reload1.c (new_insn_chain): Clear it.
	(calculate_needs_all_insns): Set it; don't overload need_reload.
	(reload_as_needed): Use it.
        ...
Comment 8 Andrew Pinski 2005-05-09 14:51:02 UTC
*** Bug 13565 has been marked as a duplicate of this bug. ***
Comment 9 Maxim Kuvyrkov 2007-05-31 08:53:23 UTC
*** Bug 31508 has been marked as a duplicate of this bug. ***
Comment 10 Andrew Pinski 2008-09-14 04:34:46 UTC
Related to PR 22072.
Comment 11 Uroš Bizjak 2009-10-01 20:51:23 UTC
None of the testcases fail anymore with GCC: (GNU) 4.5.0 20091001 (experimental) [trunk revision 152374].

The testcase from #7 produces:

foo:
	pushl	%ebp
	movl	%esp, %ebp
	pushl	%ebx
	movl	%eax, %ecx
	movl	8(%ebp), %eax
	movl	$3, %edx
	movl	%edx, %ebx
	cltd
	idivl	%ebx
	movl	%edx, (%ecx)
	popl	%ebx
	leave
	ret
Comment 12 Volker Reichelt 2009-11-09 22:13:13 UTC
The testcase from comment #7 doesn't crash since GCC 4.0.0.
The testcase from comment #4 stopped crashing in August or September,
so let's close the bug for good.