[llvm-bugs] [Bug 45971] New: Wrong line information at Og
via llvm-bugs
llvm-bugs at lists.llvm.org
Mon May 18 03:18:11 PDT 2020
https://bugs.llvm.org/show_bug.cgi?id=45971
Bug ID: 45971
Summary: Wrong line information at Og
Product: clang
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Keywords: wrong-debug
Severity: enhancement
Priority: P
Component: -New Bugs
Assignee: unassignedclangbugs at nondot.org
Reporter: massarelli at diag.uniroma1.it
CC: ditaliano at apple.com, htmldeveloper at gmail.com,
llvm-bugs at lists.llvm.org, neeilans at live.com,
richard-llvm at metafoo.co.uk
Line 8 should not be hit during debugging.
$ cat a.c
char a, b;
int g_37[] = {1};
int c;
char(d)() { return a; }
void e() {
if (g_37[0])
return;
--b &&d() || c;
}
int main() { e(); }
$ clang -v
clang version 11.0.0 (https://github.com/llvm/llvm-project.git
709c52b9553f4ba83ab901a873392f8a7f2c56a5)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/bin
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7.5.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/8
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7.5.0
Candidate multilib: .;@m64
Selected multilib: .;@m64
$ lldb -v
lldb version 11.0.0
clang revision 709c52b9553f4ba83ab901a873392f8a7f2c56a5
llvm revision 709c52b9553f4ba83ab901a873392f8a7f2c56a5
$ gdb -v
GNU gdb (Ubuntu 8.1-0ubuntu3.2) 8.1.0.20180409-git
$ clang -Og -g -o opt a.c
$ lldb opt
(lldb) target create "opt"
Current executable set to 'opt' (x86_64).
(lldb) b main
Breakpoint 1: where = opt`main + 1 at a.c:10:14, address = 0x00000000004004b1
(lldb) r
Process 231 launched: '/home/stepping/output/opt' (x86_64)
Process 231 stopped
* thread #1, name = 'opt', stop reason = breakpoint 1.1
frame #0: 0x00000000004004b1 opt`main at a.c:10:14
7 return;
8 --b &&d() || c;
9 }
-> 10 int main() { e(); }
(lldb) s
Process 231 stopped
* thread #1, name = 'opt', stop reason = step in
frame #0: 0x0000000000400490 opt`e at a.c:6:7
3 int c;
4 char(d)() { return a; }
5 void e() {
-> 6 if (g_37[0])
7 return;
8 --b &&d() || c;
9 }
(lldb) s
Process 231 stopped
* thread #1, name = 'opt', stop reason = step in
frame #0: 0x0000000000400499 opt`e at a.c:8:13
5 void e() {
6 if (g_37[0])
7 return;
-> 8 --b &&d() || c;
9 }
10 int main() { e(); }
(lldb) di
opt`e:
0x400490 <+0>: cmpl $0x0, 0x200b91(%rip) ; __dso_handle + 7
0x400497 <+7>: je 0x40049a ; <+10> at a.c:8:3
-> 0x400499 <+9>: retq
0x40049a <+10>: addb $-0x1, 0x200b90(%rip) ; opt.PT_LOAD[1]..bss + 4
0x4004a1 <+17>: retq
$ gdb opt
(gdb) b main
Breakpoint 1 at 0x4004b1: file a.c, line 10.
(gdb) r
Starting program: opt
Breakpoint 1, main () at a.c:10
10 int main() { e(); }
(gdb) s
e () at a.c:6
6 if (g_37[0])
(gdb) s
e () at a.c:8
8 --b &&d() || c;
(gdb) s
0x00007ffff7a05b97 in __libc_start_main () from /lib/x86_64-linux-gnu/libc.so.6
(gdb)
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20200518/e093f5f8/attachment.html>
More information about the llvm-bugs
mailing list