<html>
<head>
<base href="http://llvm.org/bugs/" />
</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 --- - __builtin_return_address(0) returns junk with the post-RA scheduler"
href="http://llvm.org/bugs/show_bug.cgi?id=21976">21976</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>__builtin_return_address(0) returns junk with the post-RA scheduler
</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>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>Backend: PowerPC
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>jay.foad@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvmbugs@cs.uiuc.edu
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>Created <span class=""><a href="attachment.cgi?id=13575" name="attach_13575" title="test case">attachment 13575</a> <a href="attachment.cgi?id=13575&action=edit" title="test case">[details]</a></span>
test case
With the attached test case I get:
$ llc -o - bra.ll
...
.L.f:
.cfi_startproc
# BB#0:
mflr 0
ld 3, 16(1)
std 0, 16(1)
ld 0, 16(1)
mtlr 0
blr
...
Note that the return value (register 3) is loaded from the stack *before*
register 0 (copied from the link register) is stored, so this code will return
a junk value.
A workaround is to disable the post-RA scheduler:
$ llc -o - bra.ll -post-RA-scheduler=false
...
.L.f:
.cfi_startproc
# BB#0:
mflr 0
std 0, 16(1)
ld 3, 16(1)
ld 0, 16(1)
mtlr 0
blr
...
So I guess the post-RA scheduler doesn't understand the dependency between the
store and the load from this stack slot.
This bug is causing the sanitizer test case print-stack-trace.cc to fail on my
PowerPC64 box.</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>