From: Michael Elizabeth Chastain <mec@shout.net>
To: gdb@sources.redhat.com
Subject: gcc HEAD moves line number directives -- gcc bug?
Date: Mon, 01 Sep 2003 17:13:00 -0000 [thread overview]
Message-ID: <200309011713.h81HDtHx003770@duracef.shout.net> (raw)
This looks like another bug in gcc HEAD. If you guys agree, I'll
file a bug report against gcc.
Here is some source code from gdb.mi/until.c:
/* 20 */ main ()
/* 21 */ {
/* 22 */ int a = 1;
/* 23 */ foo ();
/* 24 */ a += 2;
/* 25 */ return 0;
/* 26 */ }
Here is the assembly code, gcc 3.3.1 -gdwarf-2 -S,
native i686-pc-linux-gnu:
.globl main
.type main, @function
main:
.LFB5:
.loc 1 21 0
pushl %ebp
.LCFI3:
movl %esp, %ebp
.LCFI4:
subl $8, %esp
.LCFI5:
andl $-16, %esp
movl $0, %eax
subl %eax, %esp
.loc 1 22 0
.LBB3:
movl $1, -4(%ebp)
.loc 1 23 0
call foo
.loc 1 24 0
leal -4(%ebp), %eax
addl $2, (%eax)
.loc 1 25 0
movl $0, %eax
.loc 1 26 0
leave
ret
.LBE3:
.LFE5:
.size main, .-main
Here is the assembly code, gcc HEAD -gdwarf-2 -S,
native i686-pc-linux-gnu:
.globl main
.type main, @function
main:
.LFB5:
.loc 1 21 0
pushl %ebp
.LCFI3:
movl %esp, %ebp
.LCFI4:
subl $8, %esp
.LCFI5:
andl $-16, %esp
movl $0, %eax
subl %eax, %esp
.loc 1 22 0
movl $1, -4(%ebp)
.loc 1 23 0
call foo
leal -4(%ebp), %eax
.loc 1 24 0
addl $2, (%eax)
.loc 1 25 0
movl $0, %eax
.loc 1 26 0
leave
ret
.LFE5:
.size main, .-main
Look at the code near 'call foo'. In gcc 3.3.1, the .loc lines
match the source code. In gcc HEAD, the .loc line for line 24
has migrated.
Source code:
/* 23 */ foo ();
/* 24 */ a += 2;
gcc 3.3.1 output:
.loc 1 23 0
call foo
.loc 1 24 0
leal -4(%ebp), %eax
addl $2, (%eax)
gcc HEAD output:
.loc 1 23 0
call foo
leal -4(%ebp), %eax // this insn is part of line 24
.loc 1 24 0 // this moved!
addl $2, (%eax)
This happens with explicit "-O0" in the command line.
This causes some mild confusion with gdb. Specifically, an 'until'
command on foo returns and says it is on line 24 with gcc 3.3.1,
but on line 23 with gcc HEAD.
I isolated the patch that caused this:
http://gcc.gnu.org/ml/gcc-patches/2003-06/msg00430.html
Jan Hubicka - Line number handling in RTL reorganization
Do you think this is a bug in gcc? I do, but I need to check here
before filing a bug report with gcc.
Michael C
next reply other threads:[~2003-09-01 17:13 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-09-01 17:13 Michael Elizabeth Chastain [this message]
2003-09-02 0:39 ` Daniel Jacobowitz
2003-09-02 3:28 Michael Elizabeth Chastain
2003-09-03 20:49 ` Richard Henderson
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=200309011713.h81HDtHx003770@duracef.shout.net \
--to=mec@shout.net \
--cc=gdb@sources.redhat.com \
/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).