[llvm-bugs] [Bug 26997] memset() is optimised out even if followed by asm("":::"memory")
via llvm-bugs
llvm-bugs at lists.llvm.org
Wed Mar 30 13:36:06 PDT 2016
https://llvm.org/bugs/show_bug.cgi?id=26997
Коренберг Марк <socketpair at gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |REOPENED
Resolution|INVALID |---
--- Comment #4 from Коренберг Марк <socketpair at gmail.com> ---
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];
}
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20160330/2337ba0a/attachment.html>
More information about the llvm-bugs
mailing list