https://bugs.llvm.org/show_bug.cgi?id=50095
Bug ID: 50095
Summary: Compilation issue when passing args on stack instead
of registers
Product: clang
Version: trunk
Hardware: PC
OS: other
Status: NEW
Severity: normal
Priority: P
Component: C
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected], [email protected],
[email protected], [email protected],
[email protected]
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
>>> str xzr, [x29, #16]
>>> ldp x29, x30, [sp], #16
b func_9(void*, void*, void*, void*, void*, void*, void*, void*,
void*)
.LBB1_2:
bl func_Error()
--------------------------------------------------------------------------
https://godbolt.org/z/oePr3eTWh
--
You are receiving this mail because:
You are on the CC list for the bug._______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs