public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug debug/41353]  New: VTA missed-debug issues
@ 2009-09-14  7:53 jakub at gcc dot gnu dot org
  2009-09-14  8:19 ` [Bug debug/41353] " jakub at gcc dot gnu dot org
                   ` (18 more replies)
  0 siblings, 19 replies; 20+ messages in thread
From: jakub at gcc dot gnu dot org @ 2009-09-14  7:53 UTC (permalink / raw)
  To: gcc-bugs

PR41343 testcase lead me to look at 3 small testcases showing VTA throwing
debug info on the floor (-gdwarf-4 -O2 in all cases):
int
foo (int i, int j)
{
  int i1 = 2 * i;
  int i2 = 3 * i;
  return j;
}
Above is a problem already during RTL expansion, SSA_NAME i_1 (of PARM_DECL i,
with GIMPLE_NOP in SSA_NAME_DEF_STMT) is expanded to NULL by expand_debug_expr,
because var_to_partition returns NO_PARTITION for it.  I think we could special
case the initial SSA_NAMEs of parameters and expand them as the parameters.

int i = 1, j;

int
foo (void)
{
  int i1 = 2 * i;
  int i2 = 3 * i;
  return j;
}

In this case we emit i2 debug info correctly:
        .byte   0x3     # DW_OP_addr
        .quad   i
        .byte   0x6     # DW_OP_deref
        .byte   0x33    # DW_OP_lit3
        .byte   0x1e    # DW_OP_mul
        .byte   0x9f    # DW_OP_stack_value
        .byte   0x93    # DW_OP_piece
        .uleb128 0x4
but i1 is lost (has empty location list).  In *.compgotos things look still
good to me:
(debug_insn 5 2 6 2 d.c:6 (var_location:SI i1 (mult:SI (mem/c/i:SI
(symbol_ref:DI ("i") [flags 0x2] <var_decl 0x7f36e4772820 i>) [2 i+0 S4 A32])
        (const_int 2 [0x2]))) -1 (nil))

(debug_insn 6 5 12 2 d.c:7 (var_location:SI i2 (mult:SI (mem/c/i:SI
(symbol_ref:DI ("i") [flags 0x2] <var_decl 0x7f36e4772820 i>) [2 i+0 S4 A32])
        (const_int 3 [0x3]))) -1 (nil))
are the only places where i1 and i2 are mentioned.  But var-tracking messes it
up:
(note 24 2 23 2 (var_location i1 (expr_list:REG_DEP_TRUE (ashift:SI (mem/c/i:SI
(symbol_ref:DI ("i") [flags 0x2] <var_decl 0x7f36e4772820 i>) [2 i+0 S4 A32])
        (const_int 1 [0x1]))
    (const_int 0 [0x0]))) NOTE_INSN_VAR_LOCATION)

(note 23 24 25 2 (var_location i1 (nil)) NOTE_INSN_VAR_LOCATION)

(note 25 23 12 2 (var_location i2 (expr_list:REG_DEP_TRUE (mult:SI (mem/c/i:SI
(symbol_ref:DI ("i") [flags 0x2] <var_decl 0x7f36e4772820 i>) [2 i+0 S4 A32])
        (const_int 3 [0x3]))
    (const_int 0 [0x0]))) NOTE_INSN_VAR_LOCATION)
(note the second i1 note).

And my last testcase is:
int i, j;

int
foo (void)
{
  int i1 = 2 * i;
  int i2 = 3 * i;
  return j;
}

Here info is dropped at RTL expansion time, as the VAR_DECL doesn't have RTL
set yet during the expansion.  It is common though, so it will be emitted in
the current TU anyway.  Another case would be extern int i, j; where it is
questionable if the debug info should reference an external variable which
wouldn't be mentioned anywhere in the TU.


-- 
           Summary: VTA missed-debug issues
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: debug
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jakub at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41353


^ permalink raw reply	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2009-10-08 19:22 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-09-14  7:53 [Bug debug/41353] New: VTA missed-debug issues jakub at gcc dot gnu dot org
2009-09-14  8:19 ` [Bug debug/41353] " jakub at gcc dot gnu dot org
2009-09-14  9:15 ` jakub at gcc dot gnu dot org
2009-09-14 10:09 ` rguenth at gcc dot gnu dot org
2009-09-14 17:36 ` jakub at gcc dot gnu dot org
2009-09-15 13:45 ` jakub at gcc dot gnu dot org
2009-09-16 11:49 ` jakub at gcc dot gnu dot org
2009-09-16 11:53 ` jakub at gcc dot gnu dot org
2009-09-16 16:42 ` jakub at gcc dot gnu dot org
2009-09-16 16:43 ` jakub at gcc dot gnu dot org
2009-09-16 17:17 ` jakub at gcc dot gnu dot org
2009-09-16 17:20 ` jakub at gcc dot gnu dot org
2009-09-21 18:32 ` jakub at gcc dot gnu dot org
2009-09-23 16:31 ` aoliva at gcc dot gnu dot org
2009-10-02 15:02 ` jakub at gcc dot gnu dot org
2009-10-06  6:06 ` aoliva at gcc dot gnu dot org
2009-10-06  6:10 ` aoliva at gcc dot gnu dot org
2009-10-06  7:53 ` aoliva at gcc dot gnu dot org
2009-10-08 19:20 ` aoliva at gcc dot gnu dot org
2009-10-08 19:22 ` aoliva at gcc dot gnu dot org

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).