public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug rtl-optimization/55346] New: var-tracking generates incomplete/inaccurate debug info
@ 2012-11-15 19:53 eager at eagercon dot com
  2012-11-15 19:54 ` [Bug rtl-optimization/55346] " eager at eagercon dot com
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: eager at eagercon dot com @ 2012-11-15 19:53 UTC (permalink / raw)
  To: gcc-bugs


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

             Bug #: 55346
           Summary: var-tracking generates incomplete/inaccurate debug
                    info
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: major
          Priority: P3
         Component: rtl-optimization
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: eager@eagercon.com


Created attachment 28703
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=28703
Test program

Var-tracking is does not record the lifetime of variables allocated to
registers correctly, resulting in gdb displaying the variable as "optimized
out" when it is live.  I've confirmed this problem on x86 and arm.  

The test case is a loop which parses command line options, indexed by integer
variable argno.  When compiled with "-g -O2", argno is allocated to rbx, which
is never reused.  The DWARF location list which is generated from
NOTE_INSN_VAR_LOCATION insns, shows disjoint allocations for argno, omitting PC
ranges where the variable is live in rbx.

The DWARF location list has argno as literal 1 beyond the instruction where it
is allocated to rbx.  Argno is defined as rbx starts several instructions after
it is allocated and ends premature.

Var-tracking inserts a NOTE_INSN_VAR_LOCATION for argno as const int 1 at the
start of the BB #2, but one is not inserted when argno is allocated to rbx
later in BB #2.  One is generated later, in BB #5.

Var-tracking inserts a (nil) NOTE_INSN_VAR_LOCATION for argno after BB #3
(branch to epilogue), although argno is live and is used in BB #4, immediately
following BB #3.  Either this should not be generated or another
NOTE_INSN_VAR_LOCATION for argno should be generated at the start of BB #4.


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

* [Bug rtl-optimization/55346] var-tracking generates incomplete/inaccurate debug info
  2012-11-15 19:53 [Bug rtl-optimization/55346] New: var-tracking generates incomplete/inaccurate debug info eager at eagercon dot com
@ 2012-11-15 19:54 ` eager at eagercon dot com
  2012-11-15 21:42 ` jakub at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: eager at eagercon dot com @ 2012-11-15 19:54 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #1 from Michael Eager <eager at eagercon dot com> 2012-11-15 19:53:53 UTC ---
Created attachment 28704
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=28704
Disassembly and location list


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

* [Bug rtl-optimization/55346] var-tracking generates incomplete/inaccurate debug info
  2012-11-15 19:53 [Bug rtl-optimization/55346] New: var-tracking generates incomplete/inaccurate debug info eager at eagercon dot com
  2012-11-15 19:54 ` [Bug rtl-optimization/55346] " eager at eagercon dot com
@ 2012-11-15 21:42 ` jakub at gcc dot gnu.org
  2012-11-15 22:37 ` eager at eagercon dot com
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: jakub at gcc dot gnu.org @ 2012-11-15 21:42 UTC (permalink / raw)
  To: gcc-bugs


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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> 2012-11-15 21:42:34 UTC ---
Which gcc version exactly (svn rev or date) you were using?
I can't reproduce this on x86_64-linux with current trunk and -g -O2.
 <2><68>: Abbrev Number: 4 (DW_TAG_variable)
    <69>   DW_AT_name        : (indirect string, offset: 0x74): argno
    <6d>   DW_AT_decl_file   : 1
    <6e>   DW_AT_decl_line   : 4
    <6f>   DW_AT_type        : <0x124>
    <73>   DW_AT_location    : 0x98(location list)
...
    00000098 0000000000400420 0000000000400437 (DW_OP_lit1; DW_OP_stack_value)
    00000098 0000000000400437 0000000000400483 (DW_OP_reg3 (rbx))
    00000098 0000000000400483 0000000000400488 (DW_OP_breg3 (rbx): -1;
DW_OP_stack_value)
    00000098 0000000000400488 0000000000400491 (DW_OP_reg3 (rbx))
    00000098 000000000040049f 00000000004004cc (DW_OP_reg3 (rbx))
    00000098 <End of list>

The only gap in there is in between 491 and 49f, and that is the epilogue:
  400491:       0f 1f 80 00 00 00 00    nopl   0x0(%rax)
  400498:       5b                      pop    %rbx
  400499:       5d                      pop    %rbp
  40049a:       31 c0                   xor    %eax,%eax
  40049c:       41 5c                   pop    %r12
  40049e:       c3                      retq   
  40049f:       90                      nop

I can reproduce it with r192900 though, so I bet this is a dup of PR54693
(which after all was your testcase).


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

* [Bug rtl-optimization/55346] var-tracking generates incomplete/inaccurate debug info
  2012-11-15 19:53 [Bug rtl-optimization/55346] New: var-tracking generates incomplete/inaccurate debug info eager at eagercon dot com
  2012-11-15 19:54 ` [Bug rtl-optimization/55346] " eager at eagercon dot com
  2012-11-15 21:42 ` jakub at gcc dot gnu.org
@ 2012-11-15 22:37 ` eager at eagercon dot com
  2012-11-19 22:00 ` eager at eagercon dot com
  2012-11-19 22:31 ` jakub at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: eager at eagercon dot com @ 2012-11-15 22:37 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #3 from Michael Eager <eager at eagercon dot com> 2012-11-15 22:36:58 UTC ---
Top of tree as of Oct 20, 2012.  I'll update and verify.

On 11/15/2012 01:42 PM, jakub at gcc dot gnu.org wrote:
>
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55346
>
> Jakub Jelinek <jakub at gcc dot gnu.org> changed:
>
>             What    |Removed                     |Added
> ----------------------------------------------------------------------------
>                   CC|                            |jakub at gcc dot gnu.org
>
> --- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> 2012-11-15 21:42:34 UTC ---
> Which gcc version exactly (svn rev or date) you were using?
> I can't reproduce this on x86_64-linux with current trunk and -g -O2.
>   <2><68>: Abbrev Number: 4 (DW_TAG_variable)
>      <69>   DW_AT_name        : (indirect string, offset: 0x74): argno
>      <6d>   DW_AT_decl_file   : 1
>      <6e>   DW_AT_decl_line   : 4
>      <6f>   DW_AT_type        : <0x124>
>      <73>   DW_AT_location    : 0x98(location list)
> ...
>      00000098 0000000000400420 0000000000400437 (DW_OP_lit1; DW_OP_stack_value)
>      00000098 0000000000400437 0000000000400483 (DW_OP_reg3 (rbx))
>      00000098 0000000000400483 0000000000400488 (DW_OP_breg3 (rbx): -1;
> DW_OP_stack_value)
>      00000098 0000000000400488 0000000000400491 (DW_OP_reg3 (rbx))
>      00000098 000000000040049f 00000000004004cc (DW_OP_reg3 (rbx))
>      00000098 <End of list>
>
> The only gap in there is in between 491 and 49f, and that is the epilogue:
>    400491:       0f 1f 80 00 00 00 00    nopl   0x0(%rax)
>    400498:       5b                      pop    %rbx
>    400499:       5d                      pop    %rbp
>    40049a:       31 c0                   xor    %eax,%eax
>    40049c:       41 5c                   pop    %r12
>    40049e:       c3                      retq
>    40049f:       90                      nop
>
> I can reproduce it with r192900 though, so I bet this is a dup of PR54693
> (which after all was your testcase).
>


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

* [Bug rtl-optimization/55346] var-tracking generates incomplete/inaccurate debug info
  2012-11-15 19:53 [Bug rtl-optimization/55346] New: var-tracking generates incomplete/inaccurate debug info eager at eagercon dot com
                   ` (2 preceding siblings ...)
  2012-11-15 22:37 ` eager at eagercon dot com
@ 2012-11-19 22:00 ` eager at eagercon dot com
  2012-11-19 22:31 ` jakub at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: eager at eagercon dot com @ 2012-11-19 22:00 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #4 from Michael Eager <eager at eagercon dot com> 2012-11-19 21:59:50 UTC ---
Confirmed fixed r193543 (2012-11-15).

gdb-7.5 (top of tree) displays argno correctly; gdb-7.3 does not.


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

* [Bug rtl-optimization/55346] var-tracking generates incomplete/inaccurate debug info
  2012-11-15 19:53 [Bug rtl-optimization/55346] New: var-tracking generates incomplete/inaccurate debug info eager at eagercon dot com
                   ` (3 preceding siblings ...)
  2012-11-19 22:00 ` eager at eagercon dot com
@ 2012-11-19 22:31 ` jakub at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: jakub at gcc dot gnu.org @ 2012-11-19 22:31 UTC (permalink / raw)
  To: gcc-bugs


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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |FIXED

--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> 2012-11-19 22:31:24 UTC ---
Yes, gdb 7.3 doesn't support constant class DW_AT_high_pc among other things,
and GCC 4.8 emits that.


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

end of thread, other threads:[~2012-11-19 22:31 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-11-15 19:53 [Bug rtl-optimization/55346] New: var-tracking generates incomplete/inaccurate debug info eager at eagercon dot com
2012-11-15 19:54 ` [Bug rtl-optimization/55346] " eager at eagercon dot com
2012-11-15 21:42 ` jakub at gcc dot gnu.org
2012-11-15 22:37 ` eager at eagercon dot com
2012-11-19 22:00 ` eager at eagercon dot com
2012-11-19 22:31 ` jakub at gcc dot gnu.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).