<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 - Compilation issue when passing args on stack instead of registers"
href="https://bugs.llvm.org/show_bug.cgi?id=50095">50095</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Compilation issue when passing args on stack instead of registers
</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>other
</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>C
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>ian.denny@miniclip.com
</td>
</tr>
<tr>
<th>CC</th>
<td>blitzrakete@gmail.com, dgregor@apple.com, erik.pilkington@gmail.com, llvm-bugs@lists.llvm.org, richard-llvm@metafoo.co.uk
</td>
</tr></table>
<p>
<div>
<pre>The following code, when compiled for armv8a, looks like it corrupting the
stack at sp+16 when it's writing a zero value parameter over the register x29
temp storage. If it helps I have also reproduced the issue online using
godbolt.
--------------------------------------------------------------------------
extern __attribute__ ((noreturn)) void func_Error();
extern void func_9 (void * p1, void* p2, void* p3, void* p4, void* p5, void*
p6, void* p7, void* p8, void* p9);
void NullCheck(void * p)
{
if (p == 0) func_Error();
}
void testfunc2 (void * p1, void* p2, void* p3, void* p4, void* p5, void* p6,
void* p7, void* p8, void* p9)
{
NullCheck((void *)p1);
func_9(p1, p2, p3, p4, p5, p6, p7, p8, 0);
}
--------------------------------------------------------------------------
NullCheck(void*):
cbz x0, .LBB0_2
ret
.LBB0_2:
stp x29, x30, [sp, #-16]!
mov x29, sp
bl func_Error()
testfunc2(void*, void*, void*, void*, void*, void*, void*, void*, void*):
stp x29, x30, [sp, #-16]!
mov x29, sp
cbz x0, .LBB1_2
<span class="quote">>>> str xzr, [x29, #16]
>>> ldp x29, x30, [sp], #16</span >
b func_9(void*, void*, void*, void*, void*, void*, void*, void*,
void*)
.LBB1_2:
bl func_Error()
--------------------------------------------------------------------------
<a href="https://godbolt.org/z/oePr3eTWh">https://godbolt.org/z/oePr3eTWh</a></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>