public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug debug/95835] New: Wrong line information at Og
@ 2020-06-23 9:05 massarelli at diag dot uniroma1.it
2020-06-23 11:22 ` [Bug c/95835] " rguenth at gcc dot gnu.org
0 siblings, 1 reply; 2+ messages in thread
From: massarelli at diag dot uniroma1.it @ 2020-06-23 9:05 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95835
Bug ID: 95835
Summary: Wrong line information at Og
Product: gcc
Version: 11.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: debug
Assignee: unassigned at gcc dot gnu.org
Reporter: massarelli at diag dot uniroma1.it
Target Milestone: ---
Line information is wrong at line 6.
Line 6 should not be hit as it is the declaration of variables.
>From the disassembly, it seems that the program is actually executing line 5.
$ cat a.c
int a ;
int main () {
for (;
a < 2;
a++) {
int i, j, k;
}
}
$ cat -n a.c
1 int a ;
2 int main () {
3 for (;
4 a < 2;
5 a++) {
6 int i, j, k;
7 }
8 }
$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/local/bin/../libexec/gcc/x86_64-pc-linux-gnu/11.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ./configure --prefix=/tmp/gcc_build --disable-multilib
--enable-languages=c,c++
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 11.0.0 20200619 (experimental) (GCC)
$ gdb -v
GNU gdb (Ubuntu 8.1-0ubuntu3.2) 8.1.0.20180409-git
$ gcc -Og -g -o opt a.c
$ gdb opt
(gdb) b main
Breakpoint 1 at 0x400486: file a.c, line 3.
(gdb) r
Starting program: opt
Breakpoint 1, main () at aaa.c:3
3 for (;
(gdb) s
4 a < 2;
(gdb) s
6 int i, j, k;
(gdb) disassemble
Dump of assembler code for function main:
0x0000000000400486 <+0>: jmp 0x400491 <main+11>
=> 0x0000000000400488 <+2>: add $0x1,%eax
0x000000000040048b <+5>: mov %eax,0x200b9b(%rip) # 0x60102c
<a>
0x0000000000400491 <+11>: mov 0x200b95(%rip),%eax # 0x60102c
<a>
0x0000000000400497 <+17>: cmp $0x1,%eax
0x000000000040049a <+20>: jle 0x400488 <main+2>
0x000000000040049c <+22>: mov $0x0,%eax
0x00000000004004a1 <+27>: retq
End of assembler dump.
(gdb)
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug c/95835] Wrong line information at Og
2020-06-23 9:05 [Bug debug/95835] New: Wrong line information at Og massarelli at diag dot uniroma1.it
@ 2020-06-23 11:22 ` rguenth at gcc dot gnu.org
0 siblings, 0 replies; 2+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-06-23 11:22 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95835
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Last reconfirmed| |2020-06-23
Component|debug |c
Ever confirmed|0 |1
Status|UNCONFIRMED |NEW
Keywords| |wrong-debug
--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
In the .gimple dump there's no line 6 on stmt locations but .lower has a new
debug stmt with that line, likely from the goto location of the backedge.
I'm not sure this is "easy" to fix. Oddly enough at -O0 we don't have
debug stmts and thus this line is not mentioned.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-06-23 11:22 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-23 9:05 [Bug debug/95835] New: Wrong line information at Og massarelli at diag dot uniroma1.it
2020-06-23 11:22 ` [Bug c/95835] " rguenth 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).