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
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 happens only with '-march=i386' and '-march=i686', but not with '-march=i486' or '-march=i586'. Strange...
Both error-types still happen in gcc-3.4.1-5
still with gcc-3.4.1-9
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.