<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 - LTO misaligns the stack causing crashes"
href="https://bugs.llvm.org/show_bug.cgi?id=41257">41257</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>LTO misaligns the stack causing crashes
</td>
</tr>
<tr>
<th>Product</th>
<td>new-bugs
</td>
</tr>
<tr>
<th>Version</th>
<td>8.0
</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>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>new bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>henrik@gramner.com
</td>
</tr>
<tr>
<th>CC</th>
<td>htmldeveloper@gmail.com, llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>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</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>