<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 backtrace infromation at Og"
href="https://bugs.llvm.org/show_bug.cgi?id=46397">46397</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Wrong backtrace infromation at Og
</td>
</tr>
<tr>
<th>Product</th>
<td>libraries
</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>Severity</th>
<td>enhancement
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>DebugInfo
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>massarelli@diag.uniroma1.it
</td>
</tr>
<tr>
<th>CC</th>
<td>jdevlieghere@apple.com, keith.walker@arm.com, llvm-bugs@lists.llvm.org, paul_robinson@playstation.sony.com
</td>
</tr></table>
<p>
<div>
<pre>At line 11 backtrace information is wrong.
$ cat -n a.c
1 int a, b;
2 static int *c = &a;
3 int *d = &c;
4 int e = 1;
5 char(f)(g) { return g; }
6 void h(int *g) {
7 g || b;
8 if (a)
9 ;
10 else
11 d = f(1);
12 }
13 int *i() { return c; }
14 int main() {
15 int *j = i();
16 h(j);
17 }
$ cat a.c
int a, b;
static int *c = &a;
int *d = &c;
int e = 1;
char(f)(g) { return g; }
void h(int *g) {
g || b;
if (a)
;
else
d = f(1);
}
int *i() { return c; }
int main() {
int *j = i();
h(j);
}
$ clang -v
clang version 11.0.0 (<a href="https://github.com/llvm/llvm-project.git">https://github.com/llvm/llvm-project.git</a>
c143db3b1032042193c152790bcefe34365e6d6c)
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 c143db3b1032042193c152790bcefe34365e6d6c
llvm revision c143db3b1032042193c152790bcefe34365e6d6c
$ gdb -v
GNU gdb (Ubuntu 8.1-0ubuntu3.2) 8.1.0.20180409-git
$ clang -Og -g -o out a.c
$ lldb out
(lldb) target create "out"
Current executable set to 'out' (x86_64).
(lldb) b h
Breakpoint 1: where = out`h + 1 at a.c:8:7, address = 0x0000000000400491
(lldb) r
Process 330 launched: 'out' (x86_64)
Process 330 stopped
* thread #1, name = 'out', stop reason = breakpoint 1.1
frame #0: 0x0000000000400491 out`h(g=0x0000000000601044) at a.c:8:7
5 char(f)(g) { return g; }
6 void h(int *g) {
7 g || b;
-> 8 if (a)
9 ;
10 else
11 d = f(1);
(lldb) bt
* thread #1, name = 'out', stop reason = breakpoint 1.1
* frame #0: 0x0000000000400491 out`h(g=0x0000000000601044) at a.c:8:7
frame #1: 0x00000000004004de out`main at a.c:16:3
frame #2: 0x00007ffff7a05b97 libc.so.6`__libc_start_main + 231
frame #3: 0x00000000004003ba out`_start + 42
(lldb) s
Process 330 stopped
* thread #1, name = 'out', stop reason = step in
frame #0: 0x000000000040049c out`h(g=0x0000000000601044) at a.c:11:9
8 if (a)
9 ;
10 else
-> 11 d = f(1);
12 }
13 int *i() { return c; }
14 int main() {
(lldb) bt
* thread #1, name = 'out', stop reason = step in
* frame #0: 0x000000000040049c out`h(g=0x0000000000601044) at a.c:11:9
frame #1: 0x0000000000601044 out`__TMC_END__ + 4
frame #2: 0x00000000004004de out`main at a.c:16:3
frame #3: 0x00007ffff7a05b97 libc.so.6`__libc_start_main + 231
frame #4: 0x00000000004003ba out`_start + 42
(lldb)
$ gdb out
(gdb) b h
Breakpoint 1 at 0x400491: file a.c, line 8.
(gdb) r
Starting program: /home/stepping/output/opt
Breakpoint 1, h (g=0x601044 <a>) at a.c:8
8 if (a)
(gdb) bt
#0 h (g=0x601044 <a>) at a.c:8
#1 0x00000000004004de in main () at a.c:16
(gdb) s
11 d = f(1);
(gdb) bt
#0 h (g=0x601044 <a>) at a.c:11
#1 0x00000000004004de in main () at a.c:16</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>