On Mon, May 9, 2011 at 11:43 AM, Jakub Jelinek <ja...@redhat.com> wrote:
> On Mon, May 09, 2011 at 10:58:56AM -0700, H.J. Lu wrote:
>> On Fri, May 6, 2011 at 6:11 PM, H.J. Lu <hjl.to...@gmail.com> wrote:
>> > 2011-05-06  H.J. Lu  <hongjiu...@intel.com>
>> >
>> >        PR debug/48853
>> >        * dwarf2out.c (mem_loc_descriptor) <case SUBREG>: If
>> >        POINTERS_EXTEND_UNSIGNED, don't give up if mode is Pmode and
>> >        mem_mode is not VOIDmode.
>> >
>> > diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
>> > index 026e4a7..049ca8e 100644
>> > --- a/gcc/dwarf2out.c
>> > +++ b/gcc/dwarf2out.c
>> > @@ -13892,7 +13892,11 @@ mem_loc_descriptor (rtx rtl, enum machine_mode 
>> > mode,
>> >        break;
>> >       if (GET_MODE_CLASS (mode) == MODE_INT
>> >          && GET_MODE_CLASS (GET_MODE (SUBREG_REG (rtl))) == MODE_INT
>> > -         && GET_MODE_SIZE (mode) <= DWARF2_ADDR_SIZE
>> > +         && (GET_MODE_SIZE (mode) <= DWARF2_ADDR_SIZE
>> > +#ifdef POINTERS_EXTEND_UNSIGNED
>> > +             || (mode == Pmode && mem_mode != VOIDmode)
>> > +#endif
>> > +            )
>> >          && GET_MODE_SIZE (GET_MODE (SUBREG_REG (rtl))) <= 
>> > DWARF2_ADDR_SIZE)
>> >        {
>> >          mem_loc_result = mem_loc_descriptor (SUBREG_REG (rtl),
>> >
>>
>> PING.
>
> Can you please explain how do you get such a SUBREG in a MEM address?


For

extern void abort (void);
int a[1024];
volatile short int v;

int
foo (int i, int j)
{
  int b = i;
  int c = i + 4;
  int d = a[i];
  int e = a[i + 6];
  ++v;
  return ++j;
}

I got

Breakpoint 5, mem_loc_descriptor (rtl=0x7ffff0655378, mode=DImode,
    mem_mode=SImode, initialized=VAR_INIT_STATUS_INITIALIZED)
    at /export/gnu/import/git/gcc-x32/gcc/dwarf2out.c:13890
13890             mem_loc_result = mem_loc_descriptor (SUBREG_REG (rtl),
(gdb) bt
#0  mem_loc_descriptor (rtl=0x7ffff0655378, mode=DImode, mem_mode=SImode,
    initialized=VAR_INIT_STATUS_INITIALIZED)
    at /export/gnu/import/git/gcc-x32/gcc/dwarf2out.c:13890
#1  0x00000000006d853e in mem_loc_descriptor (rtl=0x7ffff0655348, mode=DImode,
    mem_mode=SImode, initialized=VAR_INIT_STATUS_INITIALIZED)
    at /export/gnu/import/git/gcc-x32/gcc/dwarf2out.c:14187
#2  0x00000000006dace1 in loc_descriptor (rtl=0x7ffff0655330, mode=SImode,
    initialized=VAR_INIT_STATUS_INITIALIZED)
    at /export/gnu/import/git/gcc-x32/gcc/dwarf2out.c:15038
#3  0x00000000006dadfb in loc_descriptor (rtl=0x7ffff05eff00, mode=SImode,
    initialized=VAR_INIT_STATUS_INITIALIZED)
    at /export/gnu/import/git/gcc-x32/gcc/dwarf2out.c:15066
#4  0x00000000006dbc3a in dw_loc_list_1 (loc=0x7ffff0606280,
    varloc=0x7ffff05eff00, want_address=2,
    initialized=VAR_INIT_STATUS_INITIALIZED)
    at /export/gnu/import/git/gcc-x32/gcc/dwarf2out.c:15341
#5  0x00000000006dc583 in dw_loc_list (loc_list=0x7ffff0656060,
    decl=0x7ffff0606280, want_address=2)
    at /export/gnu/import/git/gcc-x32/gcc/dwarf2out.c:15597
#6  0x00000000006dd8f1 in loc_list_from_tree (loc=0x7ffff0606280,
    want_address=2) at /export/gnu/import/git/gcc-x32/gcc/dwarf2out.c:15985
#7  0x00000000006e3d52 in add_location_or_const_value_attribute (
    die=0x7ffff06506e0, decl=0x7ffff0606280, cache_p=0 '\000',
---Type <return> to continue, or q <return> to quit---q
attr=DW_AT_locatiQuit
(gdb) call debug_rtx (rtl)
(subreg:DI (ashift:SI (entry_value:SI (reg:SI 5 di [ i ]))
        (const_int 2 [0x2])) 0)
(gdb) f 1
#1  0x00000000006d853e in mem_loc_descriptor (rtl=0x7ffff0655348, mode=DImode,
    mem_mode=SImode, initialized=VAR_INIT_STATUS_INITIALIZED)
    at /export/gnu/import/git/gcc-x32/gcc/dwarf2out.c:14187
14187             mem_loc_result = mem_loc_descriptor (XEXP (rtl, 0), mode, 
mem_mode,
(gdb) call debug_rtx (rtl)
(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>))
(gdb) f 2
#2  0x00000000006dace1 in loc_descriptor (rtl=0x7ffff0655330, mode=SImode,
    initialized=VAR_INIT_STATUS_INITIALIZED)
    at /export/gnu/import/git/gcc-x32/gcc/dwarf2out.c:15038
15038         loc_result = mem_loc_descriptor (XEXP (rtl, 0),
get_address_mode (rtl),
(gdb) call debug_rtx (rtl)
(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) f 3
#3  0x00000000006dadfb in loc_descriptor (rtl=0x7ffff05eff00, mode=SImode,
    initialized=VAR_INIT_STATUS_INITIALIZED)
    at /export/gnu/import/git/gcc-x32/gcc/dwarf2out.c:15066
15066             loc_result = loc_descriptor (loc, mode, initialized);
(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)


-- 
H.J.

Reply via email to