[PATCH] Fix PR target/10282

Eric Botcazou ebotcazou@libertysurf.fr
Fri Apr 11 22:48:00 GMT 2003


This is a regression from gcc 3.2.2 present on 3.3 and mainline. We ICE 
during reload on the attached testcase:

x.c: In function `foo':
    x.c:17: error: unable to find a register to spill in class `Q_REGS'
    x.c:17: error: this is the insn:
    (insn 22 20 24 0 0x40153268 (set (mem:QI (plus:SI (subreg:SI (reg/v:DI 63 
[ Ld2 ]) 0)
                    (subreg:SI (reg/v:DI 62 [ Ld1 ]) 4)) [0 S1 A8])
            (subreg:QI (reg/v:SI 4 esi [orig:61 Ll ] [61]) 0)) 48 {*movqi_1} 
(insn_list 18 (insn_list 20 (nil)))
        (expr_list:REG_DEAD (reg/v:SI 4 esi [orig:61 Ll ] [61])
            (expr_list:REG_DEAD (reg/v:DI 62 [ Ld1 ])
    x.c:17: internal compiler error: in spill_failure, at reload1.c:1917

The subreg

	(subreg:QI (reg/v:SI 4 esi [orig:61 Ll ] [61]) 0)

is obviously invalid. It is generated because pseudo-reg 61 has Q_REGS as its 
preferred reload class and GENERAL_REGS as its alternate class.

I played with the new approach that consists in trying to prevent such 
invalid subregs from being generated with CANNOT_CHANGE_MODE_CLASS. This 
appears to work here.

Bootstrapped/regtested on i586-redhat-linux-gnu (c,c++,objc,f77 3.3 branch), 
bootstrapped on i586-redhat-linux-gnu (c,c++,objc,f77 mainline), regtesting 
in progress.

Eric Botcazou

2003-04-11  Eric Botcazou  <ebotcazou@libertysurf.fr>

	* config/i386/i386.h (MAYBE_NON_Q_CLASS_P): New macro.
	(CANNOT_CHANGE_MODE_CLASS): Use them. Forbid mode shrinking
	to QImode and HImode when the class contains non NON_Q_REGS.

2003-04-11  Eric Botcazou  <ebotcazou@libertysurf.fr>

	* gcc.c-torture/compile/20030411-1.c: New test.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pr10282.diff
Type: text/x-diff
Size: 2940 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20030411/4c50eb45/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pr10282.c
Type: text/x-csrc
Size: 311 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20030411/4c50eb45/attachment-0001.bin>

More information about the Gcc-patches mailing list