<html>
<head>
<base href="http://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 --- - dead store pass ignores memory clobbering asm statement"
href="http://llvm.org/bugs/show_bug.cgi?id=15495">15495</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>dead store pass ignores memory clobbering asm statement
</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>Common Code Generator Code
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>felix-llvm@fefe.de
</td>
</tr>
<tr>
<th>CC</th>
<td>llvmbugs@cs.uiuc.edu
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>Consider this function:
#include <string.h>
void foo(int x) {
char buf[10];
int i;
for (i=0; i<sizeof(buf); ++i)
buf[i]=x++;
memset(buf,0,sizeof(buf));
}
llvm removes all the write accesses to buf. OK so far.
Now let's add an asm statement to tell the optimizer that it cannot remove
writes to buf:
void foo(int x) {
char buf[10];
int i;
for (i=0; i<sizeof(buf); ++i)
buf[i]=x++;
memset(buf,0,sizeof(buf));
asm("" : : : "memory");
}
llvm ignores the asm statement and still removes all stores to the local
buffer.
I think this is a bug. At least gcc and icc honor the asm statement and don't
remove the stores if it is present.
I was using:
clang version 3.3 (trunk 176552)
Target: x86_64-unknown-linux-gnu
Thread model: posix
This bug is quite important because it may introduce security problems in
crypto code attempting to cleanse keys from memory.</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>