https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70925
Bug ID: 70925
Summary: Vectorized loop segfaults: read exceeds vector
boundary
Product: gcc
Version: 5.3.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: gentryx at gmx dot de
Target Milestone: ---
I've stumbled across a case where may vectorize a loop and the resulting
assembly will cause a segfault when the read operation exceeds a vector
boundary. Only happens with -O3 and -march=native.
Tested compilers:
icpc 15.0.6: works
clang++ 3.8.0: works
g++-4.7.4: works
g++-4.8.5: works
g++-4.9.3: fails
g++-5.3.0: fails
System: Gentoo Linux (observed on other systems, too), Intel Core i7-6700HQ
Command line: g++-5.3.0 test_lfa_lgd.ii -o test -O3 -fno-strict-aliasing
-fwrapv -std=c++11 && ./test
Output: Segmentation fault. GDB disassembly of the segfault site:
=> 0x0000000000406612 <+22514>: vmovapd (%r11,%rcx,1),%ymm0
0x0000000000406618 <+22520>: add $0x1,%rdi
0x000000000040661c <+22524>: vmovups %xmm0,(%rsi,%rcx,1)
0x0000000000406621 <+22529>: vextractf128 $0x1,%ymm0,0x10(%rsi,%rcx,1)
0x0000000000406629 <+22537>: add $0x20,%rcx
0x000000000040662d <+22541>: cmp %rdi,%r12
0x0000000000406630 <+22544>: ja 0x406612 <main+22514>
Please let me know if I can provide any further details.