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: unassignedb...@nondot.org Reporter: eli.fried...@gmail.com CC: llvm-bugs@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.
_______________________________________________ llvm-bugs mailing list llvm-bugs@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs