[llvm-bugs] [Bug 27848] New: Incorrect optimization in memcpyopt with longjmp and volatile locals
via llvm-bugs
llvm-bugs at lists.llvm.org
Mon May 23 20:10:18 PDT 2016
https://llvm.org/bugs/show_bug.cgi?id=27848
Bug ID: 27848
Summary: Incorrect optimization in memcpyopt with longjmp and
volatile locals
Product: libraries
Version: trunk
Hardware: PC
OS: Windows NT
Status: NEW
Severity: normal
Priority: P
Component: Scalar Optimizations
Assignee: unassignedbugs at nondot.org
Reporter: eli.friedman at gmail.com
CC: llvm-bugs at lists.llvm.org
Classification: Unclassified
Testcase:
#include <setjmp.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
int zz = 1;
__attribute((noinline))
void g(volatile int* y, jmp_buf *b) {
*y = 10;
if (zz) longjmp(*b, 2);
}
__attribute((noinline))
int f() {
volatile int x, y;
x = 1;
jmp_buf b;
if (setjmp(b)) return x;
g(&y, &b);
memcpy((void*)&x, (void*)&y, 4);
return x;
}
int main() { if (f() != 1) abort(); }
Runs correctly with gcc or clang -O0; aborts with clang -O2. I'm pretty sure
it's a bug in memcpyopt: it's trying to do call slot optimization on y.
--
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/20160524/41c1069b/attachment-0001.html>
More information about the llvm-bugs
mailing list