<html>
<head>
<base href="https://bugs.llvm.org/">
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - Wrong line information at Og"
href="https://bugs.llvm.org/show_bug.cgi?id=45971">45971</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Wrong line information at Og
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Keywords</th>
<td>wrong-debug
</td>
</tr>
<tr>
<th>Severity</th>
<td>enhancement
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>-New Bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>massarelli@diag.uniroma1.it
</td>
</tr>
<tr>
<th>CC</th>
<td>ditaliano@apple.com, htmldeveloper@gmail.com, llvm-bugs@lists.llvm.org, neeilans@live.com, richard-llvm@metafoo.co.uk
</td>
</tr></table>
<p>
<div>
<pre>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 (<a href="https://github.com/llvm/llvm-project.git">https://github.com/llvm/llvm-project.git</a>
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)</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>