<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 - [DebugInfo] Unused arguments aren't visible in optimized code."
href="https://bugs.llvm.org/show_bug.cgi?id=39716">39716</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>[DebugInfo] Unused arguments aren't visible in optimized code.
</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>All
</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>davide@freebsd.org
</td>
</tr>
<tr>
<th>CC</th>
<td>aprantl@apple.com, friss@apple.com, jdevlieghere@apple.com, keith.walker@arm.com, llvm-bugs@lists.llvm.org, rnk@google.com, vk@vedantk.com, vsk@apple.com, zturner@google.com
</td>
</tr></table>
<p>
<div>
<pre>* thread #1, queue = 'com.apple.main-thread', stop reason = step over
frame #0: 0x0000000100000f84 a.out`fn2(a=<unavailable>, b=<unavailable>,
c=<unavailable>) at optout.c:12:10 [opt]
9 fn2 (long int a, long int b, long int c)
10 {
11 long int q = 2 * a;
-> 12 return fn1 (5, 6, 7);
13 }
14
15 int main(void) {
(lldb) frame var
(long) a = <no location, value may have been optimized out>
(long) b = <no location, value may have been optimized out>
(long) c = <no location, value may have been optimized out>
(long) q = <no location, value may have been optimized out>
A gcc-built binary debugged with gdb yields:
Breakpoint 1, main () at opt.c:16
16 return fn2(14, 23, 34);
(gdb) s
fn2 (c=34, b=23, a=14) at opt.c:12
12 return fn1 (5, 6, 7);
(gdb) info args
c = 34
b = 23
a = 14
Testcase:
__attribute__((noinline))
int fn1 (long int x, long int y, long int z) {
int l = x * 2;
int q = y * z;
return l + q;
}
__attribute__((noinline)) long int
fn2 (long int a, long int b, long int c)
{
long int q = 2 * a;
return fn1 (5, 6, 7);
}
int main(void) {
return fn2(14, 23, 34);
}</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>