On Tue, May 10, 2011 at 7:14 AM, H.J. Lu <hjl.to...@gmail.com> wrote: > On Tue, May 10, 2011 at 2:52 AM, Jakub Jelinek <ja...@redhat.com> wrote: >> On Mon, May 09, 2011 at 01:35:39PM -0700, H.J. Lu wrote: >>> (gdb) call debug_rtx (rtl) >>> (var_location d (mem/s/j:SI (plus:DI (subreg:DI (ashift:SI >>> (entry_value:SI (reg:SI 5 di [ i ])) >>> (const_int 2 [0x2])) 0) >>> (symbol_ref:DI ("a") <var_decl 0x7ffff0606000 a>)) [0 a S4 A32])) >>> (gdb) >> >> Ugh, paradoxical subreg? Doesn't that say that the upper 32-bits are >> undefined? Surely that ought to be zero_extend, sign_extend or something >> similarly well defined... >> > > With > > [hjl@gnu-6 pr48853]$ cat x.i > extern void abort (void); > int a[1024]; > volatile short int v; > > int > foo (int i, int j) > { > int d = a[i]; > ++v; > return ++j; > } > > rtl expansion has > > ;; Start of basic block ( 2) -> 3 > ;; Pred edge 2 [100.0%] (fallthru) > (note 6 4 7 3 [bb 3] NOTE_INSN_BASIC_BLOCK) > > (debug_insn 7 6 8 3 (var_location:SI D#1 (mem/s/j:SI (plus:DI (subreg:DI > (ashift > :SI (entry_value:SI (reg:SI 5 di [ i ])) > (const_int 2 [0x2])) 0) > (symbol_ref:DI ("a") <var_decl 0x7ffff0a83000 a>)) [0 a S4 A32])) > x > .i:8 -1 > (nil)) > > > Where should I look? >
It comes from expand_debug_expr: if (offset) { enum machine_mode addrmode, offmode; if (!MEM_P (op0)) return NULL; op0 = XEXP (op0, 0); addrmode = GET_MODE (op0); if (addrmode == VOIDmode) addrmode = Pmode; op1 = expand_debug_expr (offset); if (!op1) return NULL; offmode = GET_MODE (op1); if (offmode == VOIDmode) offmode = TYPE_MODE (TREE_TYPE (offset)); if (addrmode != offmode) op1 = simplify_gen_subreg (addrmode, op1, offmode, subreg_lowpart_offset (addrmode, offmode)); /* Don't use offset_address here, we don't need a recognizable address, and we don't want to generate code. */ op0 = gen_rtx_MEM (mode, simplify_gen_binary (PLUS, addrmode, op0, op1)); } (gdb) call debug_rtx (op1) (ashift:SI (entry_value:SI (reg:SI 5 di [ i ])) (const_int 2 [0x2])) (gdb) call debug_rtx (op0) (symbol_ref:DI ("a") <var_decl 0x7ffff0a83000 a>) (gdb) p offmode $9 = SImode (gdb) p addrmode $10 = DImode (gdb) -- H.J.