Bug 127699 - Fails to compile qemu with "can't find a register in class `GENERAL_REGS' while reloading `asm'"
Fails to compile qemu with "can't find a register in class `GENERAL_REGS' whi...
Status: CLOSED NOTABUG
Product: Fedora
Classification: Fedora
Component: gcc (Show other bugs)
rawhide
All Linux
medium Severity medium
: ---
: ---
Assigned To: Jakub Jelinek
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2004-07-12 14:35 EDT by Enrico Scholz
Modified: 2007-11-30 17:10 EST (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2004-10-04 20:05:37 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Enrico Scholz 2004-07-12 14:35:31 EDT
Description of problem:

gcc fails to compile qemu-0.6.0 (http://qemu.org) with:

| gcc -Wall -O2 -g -fno-strict-aliasing -fomit-frame-pointer -mpreferred-stack-boundary=2 -falign-functions=0 -fno-reorder-blocks -fno-optimize-sibling-calls -I. -I/usr/src/redhat/BUILD/qemu-0.6.0/target-i386 -I/usr/src/redhat/BUILD/qemu-0.6.0 -D_GNU_SOURCE -I/usr/src/redhat/BUILD/qemu-0.6.0/slirp -c -o op.o /usr/src/redhat/BUILD/qemu-0.6.0/target-i386/op.c
| /usr/src/redhat/BUILD/qemu-0.6.0/target-i386/ops_template_mem.h: In function `op_rolb_kernel_T0_T1_cc':
| /usr/src/redhat/BUILD/qemu-0.6.0/softmmu_header.h:179: error: can't find a register in class `GENERAL_REGS' while reloading `asm'


Replacing the '-O2' with '-O1' makes it work so it its a compiler bug.



Version-Release number of selected component (if applicable):

gcc-3.4.1-2


How reproducible:


Steps to Reproduce:
1. wget http://fabrice.bellard.free.fr/qemu/qemu-0.6.0.tar.gz
2. tar xzf qemu-0.6.0.tar.gz && cd qemu-0.6.0
3. ./configure && make


Actual results:

| make[1]: *** [op.o] Error 1
| make[1]: Leaving directory `/tmp/qemu-0.6.0/i386'
| make: *** [all] Error 1



Additional info:

A related thread on qemu-maillist at

  http://lists.gnu.org/archive/html/qemu-devel/2004-06/msg00613.html
Comment 1 Enrico Scholz 2004-07-12 14:40:37 EDT
When continuing the build (using '-O1' instead of '-O2') the following
error occurs:

| gcc -O2 -g -pipe -m32 -march=i686 -mtune=pentium4 -fomit-frame-pointer -I. -I/usr/src/redhat/BUILD/qemu-0.6.0/target-i386 -I/usr/src/redhat/BUILD/qemu-0.6.0 -D_GNU_SOURCE -I/usr/src/redhat/BUILD/qemu-0.6.0/slirp -c -o translate-copy.o /usr/src/redhat/BUILD/qemu-0.6.0/target-i386/translate-copy.c
| /usr/src/redhat/BUILD/qemu-0.6.0/softmmu_template.h: In function `__stq_mmu':
| /usr/src/redhat/BUILD/qemu-0.6.0/softmmu_template.h:216: error: unable to find a register to spill in class `GENERAL_REGS'
| /usr/src/redhat/BUILD/qemu-0.6.0/softmmu_template.h:216: error: this is the insn:
| (insn:HI 315 299 316 13 /usr/src/redhat/BUILD/qemu-0.6.0/softmmu_template.h:245 (parallel [
|             (set (reg:DI 0 ax [194])
|                 (lshiftrt:DI (reg/v:DI 59 [ val ])
|                     (subreg:QI (reg:SI 203) 0)))
|             (clobber (scratch:SI))
|             (clobber (reg:CC 17 flags))
|         ]) 306 {lshrdi3_1} (nil)
|     (expr_list:REG_UNUSED (reg:CC 17 flags)
|         (expr_list:REG_UNUSED (scratch:SI)
|             (nil))))
| /usr/src/redhat/BUILD/qemu-0.6.0/softmmu_template.h:216: confused by earlier errors, bailing out
| make[1]: *** [helper.o] Error 1
| make[1]: *** Waiting for unfinished jobs....
| make[1]: Leaving directory `/usr/src/redhat/BUILD/qemu-0.6.0/i386'
| make: *** [all] Error 1
Comment 2 Enrico Scholz 2004-07-12 15:01:07 EDT
comment #2 happens only with '-march=i386' and '-march=i686', but not
with '-march=i486' or '-march=i586'. Strange...
Comment 3 Enrico Scholz 2004-07-16 21:16:09 EDT
Both error-types still happen in gcc-3.4.1-5
Comment 4 Enrico Scholz 2004-08-30 18:57:35 EDT
still with gcc-3.4.1-9
Comment 5 Richard Henderson 2004-10-04 20:05:37 EDT
This is not surprising, since the registers

  register struct CPUX86State *env asm("ebp");
  register uint32_t T0 asm("ebx");
  register uint32_t T1 asm("esi");
  register uint32_t T2 asm("edi");

have been reserved for the user and 

  "%eax", "%ecx", "%edx"

are all clobbered by the asm.  So all seven registers are accounted
for, leaving NOT A SINGLE register free for the allocation.

The compiler is quite right to bitch.

Note You need to log in before you can comment on or make changes to this bug.