Bug 13565 - Register spill problem in x86_64 compiler
Summary: Register spill problem in x86_64 compiler
Status: RESOLVED DUPLICATE of bug 9085
Alias: None
Product: gcc
Classification: Unclassified
Component: rtl-optimization (show other bugs)
Version: 3.3.2
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: ice-on-valid-code
Depends on:
Blocks:
 
Reported: 2004-01-05 01:40 UTC by marc@mrousseau.org
Modified: 2005-05-09 14:50 UTC (History)
1 user (show)

See Also:
Host: x86_64-pc-linux-gnu
Target: x86_64-pc-linux-gnu
Build: x86_64-pc-linux-gnu
Known to work:
Known to fail:
Last reconfirmed: 2004-11-06 18:23:22


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description marc@mrousseau.org 2004-01-05 01:40:27 UTC
	
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
Comment 1 marc@mrousseau.org 2004-01-05 01:40:27 UTC
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.
Comment 2 Andrew Pinski 2004-01-05 04:05:23 UTC
Confirmed on the mainline.
Comment 3 Jan Hubicka 2004-03-31 10:18:40 UTC
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
Comment 4 Andrew Pinski 2005-05-09 14:50:58 UTC

*** This bug has been marked as a duplicate of 9085 ***