I'm looking into http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58901 and trying to find where the following rtx is being generated:
(subreg:HI (mem/u/c:SI (plus:SI (mult:SI (reg/v:SI 0 %r0 [orig:77 count ] [77]) (const_int 4 [0x4])) (symbol_ref:SI ("DECPOWERS") [flags 0x40] <var_decl 0x7f7ff63b35f0 DECPOWERS>)) [3 DECPOWERS S4 A32]) 0) The memory reference causes mode_dependent_address_p to return true. Note I added code to gen_rtx_SUBREG to detect a MEM with a mode dependent address and print it but it never triggers. I also added code before gen_rtx_raw_SUBREG as well and those don't trigger as well. alter_subreg can't fix the subreg since it has a mode dependent address. I think this is happening in reload since 213r.ira I find: (insn 225 223 226 46 (set (reg:SI 137) (mem/u:SI (plus:SI (mult:SI (reg/v:SI 77 [ count ]) (const_int 4 [0x4])) (symbol_ref:SI ("DECPOWERS") [flags 0x40] <var_decl 0x7f7ff63b3 5f0 DECPOWERS>)) [3 DECPOWERS S4 A32])) ../../gcc-4.8.2/libdecnumber/decNumber.c :7183 12 {movsi_2} (expr_list:REG_EQUIV (mem/u:SI (plus:SI (mult:SI (reg/v:SI 77 [ count ]) (const_int 4 [0x4])) (symbol_ref:SI ("DECPOWERS") [flags 0x40] <var_decl 0x7f7ff63b3 5f0 DECPOWERS>)) [3 DECPOWERS S4 A32]) (nil))) (insn 226 225 227 46 (set (mem:HI (reg/v/f:SI 78 [ sup ]) [2 *sup_105+0 S2 A16]) (plus:HI (subreg:HI (reg:SI 137) 0) (const_int -1 [0xffffffffffffffff]))) ../../gcc-4.8.2/libdecnumber/d ecNumber.c:7183 48 {addhi3} (expr_list:REG_DEAD (reg:SI 137) (nil))) That's fine if pseudo 137 gets instantiated to a register. In 214r.reload that becomes: (insn 226 225 227 46 (set (mem:HI (reg/v/f:SI 1 %r1 [orig:78 sup ] [78]) [2 *sup _105+0 S2 A16]) (plus:HI (subreg:HI (mem/u/c:SI (plus:SI (mult:SI (reg/v:SI 0 %r0 [orig: 77 count ] [77]) (const_int 4 [0x4])) (symbol_ref:SI ("DECPOWERS") [flags 0x40] <var_decl 0x7 f7ff63b35f0 DECPOWERS>)) [3 DECPOWERS S4 A32]) 0) (const_int -1 [0xffffffffffffffff]))) ../../gcc-4.8.2/libdecnumber/d ecNumber.c:7183 48 {addhi3} (nil)) which is now invalid due to use of a mode dependent address. So who's doing this? I'm guessing it's combine but that code is opaque to me. Any ideas where to look?