<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 - x86_64 ABI only takes doesn't consult C++ info in computing return types"
href="https://bugs.llvm.org/show_bug.cgi?id=36870">36870</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>x86_64 ABI only takes doesn't consult C++ info in computing return types
</td>
</tr>
<tr>
<th>Product</th>
<td>lldb
</td>
</tr>
<tr>
<th>Version</th>
<td>unspecified
</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>All Bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>lldb-dev@lists.llvm.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>jingham@apple.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>Created <span class=""><a href="attachment.cgi?id=20105" name="attach_20105" title="Example file showing a case where we get the return wrong.">attachment 20105</a> <a href="attachment.cgi?id=20105&action=edit" title="Example file showing a case where we get the return wrong.">[details]</a></span>
Example file showing a case where we get the return wrong.
Build the attached notright.cpp and do:
> lldb notright
(lldb) b s -p "Set a breakpoint here"
Breakpoint 1: where = notright`takeS(S) + 25 at notright.cpp:10, address =
0x0000000100000e19
(lldb) run
Process 35604 launched: '/tmp/notright' (x86_64)
Process 35604 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = breakpoint 1.1
frame #0: 0x0000000100000e19 notright`takeS(S) at notright.cpp:10
7 {
8 S ret_val = inVal;
9 ret_val.ivar = 30;
-> 10 return ret_val; // Set a breakpoint here
^
11 }
12
13 int
Target 0: (notright) stopped.
(lldb) fin
Process 35604 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = step out
Return value: (S) $0 = {
ivar = -272632024
}
frame #0: 0x0000000100000ea4 notright`main at notright.cpp:17
14 main()
15 {
16 S inVal, outVal;
-> 17 outVal = takeS(inVal);
^
18
19 return 0;
20 }
Target 0: (notright) stopped.
Note that the return value was not calculated correctly. The struct is in fact
small enough and correctly aligned so by the simple Itanium ABI it should have
gotten passed in registers, but C++ for its own reasons decided to pass it in
memory instead. We have to dig more information out of the C++ type to figure
out these cases.</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are the assignee for the bug.</li>
</ul>
</body>
</html>