Bug 127699 - Fails to compile qemu with "can't find a register in class `GENERAL_REGS' while reloading `asm'"
Summary: Fails to compile qemu with "can't find a register in class `GENERAL_REGS' whi...
Alias: None
Product: Fedora
Classification: Fedora
Component: gcc (Show other bugs)
(Show other bugs)
Version: rawhide
Hardware: All Linux
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact:
Depends On:
TreeView+ depends on / blocked
Reported: 2004-07-12 18:35 UTC by Enrico Scholz
Modified: 2007-11-30 22:10 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2004-10-05 00:05:37 UTC
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

Description Enrico Scholz 2004-07-12 18:35:31 UTC
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):


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


Comment 1 Enrico Scholz 2004-07-12 18:40:37 UTC
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 19:01:07 UTC
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-17 01:16:09 UTC
Both error-types still happen in gcc-3.4.1-5

Comment 4 Enrico Scholz 2004-08-30 22:57:35 UTC
still with gcc-3.4.1-9

Comment 5 Richard Henderson 2004-10-05 00:05:37 UTC
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.