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
State-Changed-From-To: open->feedback State-Changed-Why: For some reason, the attachment got lost. Could you possibly provide it again? Thanks, Paolo.
State-Changed-From-To: feedback->open State-Changed-Why: Attachment received.
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> </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> </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> </DIV><A=20 href=3D"http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=3Dview%20audit-trail&a= mp;database=3Dgcc&pr=3D9085">http://gcc.gnu.org/cgi-bin/gnatsweb.pl?c= md=3Dview%20audit-trail&database=3Dgcc&pr=3D9085</A></BODY></HTML= > ------=_NextPart_000_01F0_01C2AEC4.BCE236C0--
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).
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
You only need: gcc -Os -mregparm=2 pr9085.cc -fschedule-insns It happens on most arch's.
// 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. ...
*** Bug 13565 has been marked as a duplicate of this bug. ***
*** Bug 31508 has been marked as a duplicate of this bug. ***
Related to PR 22072.
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
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.