<html>
<head>
<base href="https://llvm.org/bugs/" />
</head>
<body><span class="vcard"><a class="email" href="mailto:socketpair@gmail.com" title="Коренберг Марк <socketpair@gmail.com>"> <span class="fn">Коренберг Марк</span></a>
</span> changed
<a class="bz_bug_link
bz_status_REOPENED "
title="REOPENED --- - memset() is optimised out even if followed by asm("":::"memory")"
href="https://llvm.org/bugs/show_bug.cgi?id=26997">bug 26997</a>
<br>
<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>What</th>
<th>Removed</th>
<th>Added</th>
</tr>
<tr>
<td style="text-align:right;">Status</td>
<td>RESOLVED
</td>
<td>REOPENED
</td>
</tr>
<tr>
<td style="text-align:right;">Resolution</td>
<td>INVALID
</td>
<td>---
</td>
</tr></table>
<p>
<div>
<b><a class="bz_bug_link
bz_status_REOPENED "
title="REOPENED --- - memset() is optimised out even if followed by asm("":::"memory")"
href="https://llvm.org/bugs/show_bug.cgi?id=26997#c4">Comment # 4</a>
on <a class="bz_bug_link
bz_status_REOPENED "
title="REOPENED --- - memset() is optimised out even if followed by asm("":::"memory")"
href="https://llvm.org/bugs/show_bug.cgi?id=26997">bug 26997</a>
from <span class="vcard"><a class="email" href="mailto:socketpair@gmail.com" title="Коренберг Марк <socketpair@gmail.com>"> <span class="fn">Коренберг Марк</span></a>
</span></b>
<pre>OKAY.
But following program does not work as expected :)
How to fix ? Is this a bug ?
===========================
#include <string.h>
static void* memset_s(void* buf, int ch, size_t size) {
void *ret = memset(buf, 0, sizeof(buf));
asm volatile("": : "g" (buf) :"memory");
return ret;
}
int main() {
char buf[256];
memset_s(buf, 0, sizeof(buf));
return buf[0];
}</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>