Fix PR target/11475

Eric Botcazou ebotcazou@libertysurf.fr
Thu Jan 29 14:11:00 GMT 2004


This is an ICE on valid code at -O.  The combiner generates an IOR pattern 
between SUBREGs in HImode, which is matched against:

(define_insn "*movhi_lo_sum"
  [(set (match_operand:HI 0 "register_operand" "=r")
	(ior:HI (match_operand:HI 1 "arith_operand" "%r")
                (match_operand:HI 2 "arith_operand" "I")))]
  ""
  "or\t%1, %2, %0")

and accepted.  Then reload dies on the insn, because it of course can't do 
anything to turn a register into a constant described by the "I" constraint.

Fixed by fixing the pattern. Bootstrapped/regtested on sparc64-sun-solaris2.9 
and sparc-sun-solaris2.8 (3.4 branch, except Ada).


Mark, although the bug is not a regression, I'd like to put the patch on the 
3.4 branch too because it's a dumb mistake, which is explicitly mentioned in 
the manual:

     For an operand that must be a constant, you must be sure to either
     use `"immediate_operand"' for PREDICATE, or make the instruction
     pattern's extra condition require a constant, or both.  You cannot
     expect the constraints to do this work!  If the constraints allow
     only constants, but the predicate allows something else, the
     compiler will crash when that case arises.


2004-01-29  Eric Botcazou  <ebotcazou@libertysurf.fr>

	PR target/11475
	* config/sparc/sparc.md (movhi_lo_sum): Tighten predicates.


2004-01-29  Eric Botcazou  <ebotcazou@libertysurf.fr>

	* gcc.c-torture/compile/20040129-1.c: New test.


-- 
Eric Botcazou
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pr11475.diff
Type: text/x-diff
Size: 1253 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20040129/6570c7a7/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 20040129-1.c
Type: text/x-csrc
Size: 426 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20040129/6570c7a7/attachment-0001.bin>


More information about the Gcc-patches mailing list