http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50762
--- Comment #6 from Uros Bizjak <ubizjak at gmail dot com> 2011-11-09 18:30:29 UTC --- (In reply to comment #4) > It seems to me (part of) the problem is that the operand constraint is too > generic here: > > (define_insn "*lea_4_zext" > [(set (match_operand:DI 0 "register_operand" "=r") > (zero_extend:DI > (match_operand:SI 1 "lea_address_operand" "p")))] > > "p" accepts any legitimate address operand, including const_int. But those > are > then not actually accepted by the overall pattern (due to the mode check). > > When reloading within an address operand, reload verifies only the constraint; > it does not expect the case where a constraint accepts something that is later > rejected by some other check. > > One fix might be to use a more specific constraint here that does not accept > const_int. Unfortunately this approach doesn't work :( Using following patch: --cut here-- Index: i386.md =================================================================== --- i386.md (revision 181207) +++ i386.md (working copy) @@ -5560,7 +5560,7 @@ (define_insn "*lea_4_zext" [(set (match_operand:DI 0 "register_operand" "=r") (zero_extend:DI - (match_operand:SI 1 "lea_address_operand" "p")))] + (match_operand:SI 1 "lea_address_operand" "j")))] "TARGET_64BIT" "lea{l}\t{%a1, %k0|%k0, %a1}" [(set_attr "type" "lea") Index: constraints.md =================================================================== --- constraints.md (revision 181207) +++ constraints.md (working copy) @@ -127,6 +127,11 @@ (and (not (match_test "TARGET_X32")) (match_operand 0 "memory_operand"))) +(define_constraint "j" + "@internal ." + (and (not (match_code "const_int")) + (match_operand 0 "address_operand"))) + ;; Integer constant constraints. (define_constraint "I" "Integer constant in the range 0 @dots{} 31, for 32-bit shifts." --cut here-- results in: pr50762.c: In function ‘func_59’: pr50762.c:48:1: error: unable to generate reloads for: (insn 29 28 30 3 (set (reg:DI 0 ax [77]) (zero_extend:DI (plus:SI (const_int 0 [0]) (const_int 1 [0x1])))) pr50762.c:35 250 {*lea_4_zext} (expr_list:REG_DEAD (reg/v:SI 59 [ p_60 ]) (nil))) pr50762.c:48:1: internal compiler error: in find_reloads, at reload.c:3812 Please submit a full bug report,