public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "jan.kratochvil at redhat dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug debug/49382] New: -O2 -g: DW_AT_location at the very first PC is already modified
Date: Sun, 12 Jun 2011 11:15:00 -0000	[thread overview]
Message-ID: <bug-49382-4@http.gcc.gnu.org/bugzilla/> (raw)

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

           Summary: -O2 -g: DW_AT_location at the very first PC is already
                    modified
           Product: gcc
           Version: 4.5.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: debug
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: jan.kratochvil@redhat.com
                CC: jakub@gcc.gnu.org
            Target: x86_64-unknown-linux-gnu


int i;
void __attribute__((noinline, noclone))
clobber (int x)
{
  i = x;
}
void __attribute__((noinline, noclone))
func (int x)
{
  clobber (x++);
  i = 1;    /* line 11 */
}
int main (void) { func (5); return 0; }

gcc -c -Wall -g -O2

PASS gcc (GCC) 4.4.7 20110611 (prerelease)
FAIL gcc (GCC) 4.5.4 20110612 (prerelease)
FAIL gcc (GCC) 4.6.1 20110612 (prerelease)
FAIL gcc (GCC) 4.7.0 20110612 (experimental)

 <1><5c>: Abbrev Number: 2 (DW_TAG_subprogram)
    <5e>   DW_AT_name        : (indirect string, offset: 0x3d): func
    <65>   DW_AT_low_pc      : 0x10
    <6d>   DW_AT_high_pc     : 0x20
 <2><7c>: Abbrev Number: 5 (DW_TAG_formal_parameter)
    <7d>   DW_AT_name        : x
    <85>   DW_AT_location    : 0x0      (location list)

FAIL:
Offset Begin          End              Expression
000000 00000000000010 0000000000000014 (DW_OP_breg5 (rdi): 1;
DW_OP_stack_value)
000000 <End of list>
+
0000000000000010 <func>:
void __attribute__((noinline, noclone))
func (int x)
{
  clobber (x++);
  10:   e8 00 00 00 00          callq  15 <func+0x5>
                        11: R_X86_64_PC32       clobber-0x4

PASS:
Offset Begin          End              Expression
000000 00000000000010 0000000000000015 (DW_OP_reg5 (rdi))
000000 <End of list>

One should see X and not X + 1.
(gdb) break *func
Breakpoint 1 at 0x400480: file /home/jkratoch/t/entrypc.c, line 10.
(gdb) run
FAIL:
Breakpoint 1, func (x=6) at /home/jkratoch/t/entrypc.c:10
PASS:
Breakpoint 1, func (x=5) at /home/jkratoch/t/entrypc.c:10

Also at the very first PC one needs to know the register to match it
DW_TAG_GNU_call_site_parameter->DW_AT_location in the caller.


             reply	other threads:[~2011-06-12 11:15 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-12 11:15 jan.kratochvil at redhat dot com [this message]
2011-06-13 19:32 ` [Bug debug/49382] " jakub at gcc dot gnu.org
2011-06-13 19:37 ` jakub at gcc dot gnu.org
2011-06-13 19:53 ` jan.kratochvil at redhat dot com
2011-06-14 10:30 ` jakub at gcc dot gnu.org
2011-06-14 12:51 ` jan.kratochvil at redhat dot com
2011-06-14 12:55 ` jakub at gcc dot gnu.org
2011-06-15  9:57 ` jakub at gcc dot gnu.org
2011-06-15  9:59 ` 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-49382-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).