<html>
<head>
<base href="https://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 --- - Stack frame size can overflow signed 32-bit values on 64-bit targets."
href="https://llvm.org/bugs/show_bug.cgi?id=29171">29171</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Stack frame size can overflow signed 32-bit values on 64-bit targets.
</td>
</tr>
<tr>
<th>Product</th>
<td>new-bugs
</td>
</tr>
<tr>
<th>Version</th>
<td>3.9
</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>new bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>edy.burt@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>The following two functions generate differently signed stack offsets:
void good() {
int buf[(1 << 29) - 1];
buf[0] = 0;
}
void bad() {
int buf[(1 << 29) + 1];
buf[0] = 0;
}
good(): # @good()
push rbp
mov rbp, rsp
sub rsp, 2147483520
mov dword ptr [rbp - 2147483648], 0
add rsp, 2147483520
pop rbp
ret
bad(): # @bad()
push rbp
mov rbp, rsp
sub rsp, 2147483536
mov dword ptr [rbp + 2147483632], 0
add rsp, 2147483536
pop rbp
ret
As you can see, the mov ends up with a positive 64-bit offset from a negative
32-bit offset, instead of having it be sign-extended.
Also happens with stack pointer subtractions, on at least x64 and AArch64.</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>