https://llvm.org/bugs/show_bug.cgi?id=27859
Bug ID: 27859
Summary: loop-idiom miscompile with restrict and unwinding
Product: libraries
Version: trunk
Hardware: PC
OS: Windows NT
Status: NEW
Severity: normal
Priority: P
Component: Loop Optimizer
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected]
Classification: Unclassified
Testcase:
#include <cstdlib>
void f() { throw 1; }
void (*ff)() = f;
void g(char* __restrict base, unsigned size) {
for (unsigned i = 0; i < size; ++i) {
ff();
base[i] = 0;
}
}
void (*gg)(char*__restrict,unsigned) = g;
int main() {
char a[8] = {1};
try {
gg(a, 8);
} catch (...) {
if (a[0] != 1) abort();
}
}
Works with gcc and clang -O0, aborts with clang -O2.
There's a missing safety check in LoopIdiomRecognize.
(Artificial testcase.)
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs