* PING: [PATCH] Fix up typed DWARF stack support for POINTERS_EXTEND_UNSIGNED targets (PR debug/48853)
@ 2011-05-09 18:55 H.J. Lu
2011-05-09 20:17 ` Jakub Jelinek
0 siblings, 1 reply; 6+ messages in thread
From: H.J. Lu @ 2011-05-09 18:55 UTC (permalink / raw)
To: Jakub Jelinek; +Cc: Jason Merrill, Richard Henderson, gcc-patches, Steve Ellcey
On Fri, May 6, 2011 at 6:11 PM, H.J. Lu <hjl.tools@gmail.com> wrote:
> On Thu, May 5, 2011 at 2:20 AM, Jakub Jelinek <jakub@redhat.com> wrote:
>> Hi!
>>
>> My typed DWARF stack changes apparently broke ia64-hpux and H.J.'s out of
>> tree x32 target. There are several issues:
>> 1) for SUBREG mem_loc_descriptor's 3rd argument was wrong, found by code
>> inspection
>> 2) CONST/SYMBOL_REF/LABEL_REF when in MEM addresses on POINTERS_EXTEND_UNSIGNED
>> targets are often Pmode, which is unfortunately larger than DWARF2_ADDR_SIZE
>> and my conditional would just return NULL in that case instead of
>> emitting DW_OP_addr.
>> 3) and, when mem_loc_descriptor is called from unwind code, Pmodes larger
>> than DWARF2_ADDR_SIZE would result in the new DW_OP_GNU_*_type etc. ops
>> which are not allowed in .eh_frame/.debug_frame
>> The following patch ought to fix that, bootstrapped/regtested on
>> x86_64-linux and i686-linux and Steve tested it on ia64-hpux and H.J. on his
>> port. Ok for trunk?
>>
>> 2011-05-05 Jakub Jelinek <jakub@redhat.com>
>>
>> PR debug/48853
>> * dwarf2out.c (mem_loc_descriptor) <case SUBREG>: Pass mem_mode
>> instead of mode as 3rd argument to recursive call.
>> (mem_loc_descriptor) <case REG>: If POINTERS_EXTEND_UNSIGNED, don't
>> emit DW_OP_GNU_regval_type if mode is Pmode and mem_mode is not
>> VOIDmode.
>> (mem_loc_descriptor) <case SYMBOL_REF>: If POINTERS_EXTEND_UNSIGNED,
>> don't give up if mode is Pmode and mem_mode is not VOIDmode.
>> (mem_loc_descriptor) <case CONST_INT>: If POINTERS_EXTEND_UNSIGNED,
>> use int_loc_descriptor if mode is Pmode and mem_mode is not VOIDmode.
>>
>
> Here is the missing patch for case SUBREG. OK for trunk if there is
> no regressions?
>
> Thanks.
>
>
> H.J.
> ----
> 2011-05-06 H.J. Lu <hongjiu.lu@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.
--
H.J.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: PING: [PATCH] Fix up typed DWARF stack support for POINTERS_EXTEND_UNSIGNED targets (PR debug/48853)
2011-05-09 18:55 PING: [PATCH] Fix up typed DWARF stack support for POINTERS_EXTEND_UNSIGNED targets (PR debug/48853) H.J. Lu
@ 2011-05-09 20:17 ` Jakub Jelinek
2011-05-09 22:17 ` H.J. Lu
0 siblings, 1 reply; 6+ messages in thread
From: Jakub Jelinek @ 2011-05-09 20:17 UTC (permalink / raw)
To: H.J. Lu; +Cc: Jason Merrill, Richard Henderson, gcc-patches, Steve Ellcey
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.tools@gmail.com> wrote:
> > 2011-05-06  H.J. Lu  <hongjiu.lu@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?
Jakub
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: PING: [PATCH] Fix up typed DWARF stack support for POINTERS_EXTEND_UNSIGNED targets (PR debug/48853)
2011-05-09 20:17 ` Jakub Jelinek
@ 2011-05-09 22:17 ` H.J. Lu
2011-05-10 11:49 ` Jakub Jelinek
0 siblings, 1 reply; 6+ messages in thread
From: H.J. Lu @ 2011-05-09 22:17 UTC (permalink / raw)
To: Jakub Jelinek; +Cc: Jason Merrill, Richard Henderson, gcc-patches, Steve Ellcey
On Mon, May 9, 2011 at 11:43 AM, Jakub Jelinek <jakub@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.tools@gmail.com> wrote:
>> > 2011-05-06 H.J. Lu <hongjiu.lu@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.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: PING: [PATCH] Fix up typed DWARF stack support for POINTERS_EXTEND_UNSIGNED targets (PR debug/48853)
2011-05-09 22:17 ` H.J. Lu
@ 2011-05-10 11:49 ` Jakub Jelinek
2011-05-10 15:09 ` H.J. Lu
0 siblings, 1 reply; 6+ messages in thread
From: Jakub Jelinek @ 2011-05-10 11:49 UTC (permalink / raw)
To: H.J. Lu; +Cc: Jason Merrill, Richard Henderson, gcc-patches, Steve Ellcey
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...
Jakub
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: PING: [PATCH] Fix up typed DWARF stack support for POINTERS_EXTEND_UNSIGNED targets (PR debug/48853)
2011-05-10 11:49 ` Jakub Jelinek
@ 2011-05-10 15:09 ` H.J. Lu
2011-05-10 16:57 ` H.J. Lu
0 siblings, 1 reply; 6+ messages in thread
From: H.J. Lu @ 2011-05-10 15:09 UTC (permalink / raw)
To: Jakub Jelinek; +Cc: Jason Merrill, Richard Henderson, gcc-patches, Steve Ellcey
On Tue, May 10, 2011 at 2:52 AM, Jakub Jelinek <jakub@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?
Thanks.
--
H.J.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: PING: [PATCH] Fix up typed DWARF stack support for POINTERS_EXTEND_UNSIGNED targets (PR debug/48853)
2011-05-10 15:09 ` H.J. Lu
@ 2011-05-10 16:57 ` H.J. Lu
0 siblings, 0 replies; 6+ messages in thread
From: H.J. Lu @ 2011-05-10 16:57 UTC (permalink / raw)
To: Jakub Jelinek; +Cc: Jason Merrill, Richard Henderson, gcc-patches, Steve Ellcey
On Tue, May 10, 2011 at 7:14 AM, H.J. Lu <hjl.tools@gmail.com> wrote:
> On Tue, May 10, 2011 at 2:52 AM, Jakub Jelinek <jakub@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.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2011-05-10 15:54 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-09 18:55 PING: [PATCH] Fix up typed DWARF stack support for POINTERS_EXTEND_UNSIGNED targets (PR debug/48853) H.J. Lu
2011-05-09 20:17 ` Jakub Jelinek
2011-05-09 22:17 ` H.J. Lu
2011-05-10 11:49 ` Jakub Jelinek
2011-05-10 15:09 ` H.J. Lu
2011-05-10 16:57 ` H.J. Lu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).