https://bugs.llvm.org/show_bug.cgi?id=38670
Bug ID: 38670
Summary: miscompilation: segfault with -O2
Product: clang
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: C++
Assignee: unassignedclangb...@nondot.org
Reporter: ohh.epicf...@gmail.com
CC: dgre...@apple.com, llvm-bugs@lists.llvm.org
Using clang version 8.0.0 (trunk 340324) the following program crashes with
segfault with -O2. It looks like incorrect vectorization in asm. The problem
causes hand-made loop 'peeling' in example3 function. Also, clang 6.0.0 compile
this code incorrectly
#define N 1024
#define ALIGNED16 __attribute__((aligned(16)))
int ia[N] ALIGNED16;
int ib[N] ALIGNED16;
void init_memory(void *start, void *end) {
unsigned char state = 1;
while (start != end) {
state *= 7;
state ^= 0x27;
state += 1;
*((unsigned char *)start) = state;
start = ((char *)start) + 1;
}
}
typedef int aint __attribute__((__aligned__(16)));
__attribute__((noinline)) void example3(int n, aint *__restrict__ p,
aint *__restrict q) {
n--;
*p++ = *q++;
while (n--) {
*p++ = *q++;
}
}
int main() {
init_memory(&ia[0], &ia[N]);
init_memory(&ib[0], &ib[N]);
example3(N, ia, ib);
return 0;
}
--
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