<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 --- - LLVM -0z push/pop optimization clobbers the red zone"
href="https://llvm.org/bugs/show_bug.cgi?id=26023">26023</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>LLVM -0z push/pop optimization clobbers the red zone
</td>
</tr>
<tr>
<th>Product</th>
<td>libraries
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</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>Backend: X86
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>david.majnemer@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>consider:
$ cat t.c
#include <stdio.h>
int f() {
volatile char x[120] __attribute__((aligned(1)));
asm volatile("" : : "g"(x) : "memory");
x[119] = -2;
asm volatile("" : : "r"(-1));
return x[119];
}
int main() {
int x = f();
printf("%d\n", x);
}
compile with:
$ ~/llvm/Debug+Asserts/bin/clang -Oz t.c -o t
run it:
$ ./t
-1
the correct result is -2 but we push/pop'd -1 on to the stack, clobbering the
end of 'x' which exists on the red zone.
Reverting r255656, the commit which introduced the optimization, fixes this.</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>