https://bugs.llvm.org/show_bug.cgi?id=41257
Bug ID: 41257
Summary: LTO misaligns the stack causing crashes
Product: new-bugs
Version: 8.0
Hardware: PC
OS: All
Status: NEW
Severity: normal
Priority: P
Component: new bugs
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected], [email protected]
Using LTO in combination with a lager-than-default stack alignment results in
the stack becoming misaligned, which causes crashes in code that access
stack-allocated buffers using aligned AVX load/store instructions.
Minimal sample code:
void foo(int *x);
void bar(void)
{
int x;
foo(&x);
}
-O3 -shared -mstack-alignment=32
<bar>:
48 83 ec 18 sub rsp,0x18
48 8d 7c 24 14 lea rdi,[rsp+0x14]
e8 d2 fe ff ff call <foo@plt> // Correct stack alignment
48 83 c4 18 add rsp,0x18
c3 ret
-O3 -shared -mstack-alignment=32 -flto
<bar>:
50 push rax
48 8d 7c 24 04 lea rdi,[rsp+0x4]
e8 d5 fe ff ff call <foo@plt> // Incorrect stack alignment
58 pop rax
c3 ret
--
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