public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "eager at eagercon dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug rtl-optimization/55346] New: var-tracking generates incomplete/inaccurate debug info
Date: Thu, 15 Nov 2012 19:53:00 -0000	[thread overview]
Message-ID: <bug-55346-4@http.gcc.gnu.org/bugzilla/> (raw)


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.


             reply	other threads:[~2012-11-15 19:53 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-15 19:53 eager at eagercon dot com [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-55346-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).