ICE (register spill problem) when compiling the following code: <<<start test.cpp>>> int x,y; void WriteMemoryW ( int, short, int ); void opcode_DIV () { WriteMemoryW ( 0, x / y, 0 ); WriteMemoryW ( 0, x % y, 0 ); } <<<end test.cpp>>> The following output is generated: test.cpp: In function `void opcode_DIV()': test.cpp:9: error: unable to find a register to spill in class `DREG' test.cpp:9: error: this is the insn: (insn 11 13 12 0 0x2a9564cba0 (parallel [ (set (reg:SI 0 eax [59]) (div:SI (reg:SI 0 eax [61]) (mem/f:SI (symbol_ref:DI ("y")) [0 y+0 S4 A32]))) (set (reg:SI 2 ecx [60]) (mod:SI (reg:SI 0 eax [61]) (mem/f:SI (symbol_ref:DI ("y")) [0 y+0 S4 A32]))) (clobber (reg:CC 17 flags)) ]) 268 {*divmodsi4_cltd} (insn_list 10 (nil)) (expr_list:REG_DEAD (reg:SI 0 eax [61]) (expr_list:REG_UNUSED (reg:SI 2 ecx [60]) (expr_list:REG_UNUSED (reg:CC 17 flags) (nil))))) test.cpp:9: confused by earlier errors, bailing out Environment: System: Linux Marclar 2.6.0 #3 Sat Dec 20 22:16:38 EST 2003 x86_64 5 GNU/Linux Architecture: x86_64 host: x86_64-pc-linux-gnu build: x86_64-pc-linux-gnu target: x86_64-pc-linux-gnu configured with: /var/tmp/portage/gcc-3.3.2-r4/work/gcc-3.3.2/configure --prefix=/usr --bindir=/usr/x86_64-pc-linux-gnu/gcc-bin/3.3 --includedir=/usr/lib/gcc-lib/x86_64-pc-linux-gnu/3.3.2/include --datadir=/usr/share/gcc-data/x86_64-pc-linux-gnu/3.3 --mandir=/usr/share/gcc-data/x86_64-pc-linux-gnu/3.3/man --infodir=/usr/share/gcc-data/x86_64-pc-linux-gnu/3.3/info --enable-shared --host=x86_64-pc-linux-gnu --target=x86_64-pc-linux-gnu --with-system-zlib --enable-languages=c,c++,f77,objc --enable-threads=posix --enable-long-long --disable-checking --enable-cstdio=stdio --enable-clocale=generic --enable-__cxa_atexit --enable-version-specific-runtime-libs --with-gxx-include-dir=/usr/lib/gcc-lib/x86_64-pc-linux-gnu/3.3.2/include/g++-v3 --with-local-prefix=/usr/local --enable-shared --enable-nls --without-included-gettext --enable-multilib How-To-Repeat: Using the following command line: gcc -c -O -fschedule-insns test.cpp
Fix: Removing either the -O or -fschedule-insns arugments will allow the code to compile. Observation: changing the 2nd argument to the WriteMemoryW function to an int rather than short fixes the problem as well.
Confirmed on the mainline.
This is usual problem of -fschedule-insns and small register classes machines. It never worked and probably we ought to at least document this defect. Honza
*** This bug has been marked as a duplicate of 9085 ***