https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71657
Uroš Bizjak <ubizjak at gmail dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Last reconfirmed| |2016-06-26 Ever confirmed|0 |1 --- Comment #7 from Uroš Bizjak <ubizjak at gmail dot com> --- This is another manifestation of spills to vec register problems. [uros@localhost test]/ssd/uros/gcc-build-fast/gcc/cc1plus -O3 -quiet -mtune=core2 crash_main.ii [uros@localhost test]$ g++ crash_init.s crash_main.s [uros@localhost test]$ ./a.out terminate called after throwing an instance of 'std::out_of_range' what(): vector::_M_range_check: __n (which is 13673958) >= this->size() (which is 38) Aborted (core dumped) [uros@localhost test]$ /ssd/uros/gcc-build-fast/gcc/cc1plus -O3 -quiet -mtune=core2 -mtune-ctrl=^general_regs_sse_spill crash_main.ii [uros@localhost test]$ g++ crash_init.s crash_main.s [uros@localhost test]$ ./a.out The asm code in question is: ... movl 32(%rsp), %eax subl $38, %eax movd %eax, %xmm0 <- spill to vec .L29: cmpl 8(%rsp), %r10d jge .L19 movl %r10d, %ebp subl 28(%rsp), %ebp movd %xmm0, %eax <- fill from vec xorl %r8d, %r8d movl 8(%rsp), %r14d leal (%rax,%r10), %r15d leal -6(%r10), %r12d movslq %r15d, %r15 leaq (%r15,%r15,2), %r11 movslq %ebp, %rbp leaq 0(%rbp,%rbp,2), %rbx salq $3, %r11 subl %r10d, %r14d salq $3, %rbx .p2align 4,,10 .p2align 3 .L24: testl %esi, %esi jle .L27 movq v0(%rip), %rdx movq v0+8(%rip), %rax subq %rdx, %rax sarq $3, %rax imulq %r9, %rax cmpq %rbp, %rax jbe .L25 leal (%r12,%r8), %ecx addq %rbx, %rdx movq (%rdx), %rax movslq %ecx, %rcx movq 8(%rdx), %rdi leaq (%rcx,%rcx,2), %rcx movslq %r8d, %rdx subq %rax, %rdi addq %r11, %rax sarq $3, %rdi movq %rax, %xmm0 <- *clobbering* spill to vec! imulq %r9, %rdi leaq 64(%rsp), %rax addq %rax, %rcx cmpq %rdi, %r15 jnb .L26 movq %xmm0, %rax <- fill from the above spill movq (%rax), %rax movzbl (%rax,%rdx,8), %edi xorl %eax, %eax .p2align 4,,10 .p2align 3 .L28: movl %edi, %edx subb (%rcx,%rax), %dl movb %dl, 0(%r13,%rax) addq $1, %rax cmpl %eax, %esi jg .L28 .L27: addl $1, %r8d cmpl %r14d, %r8d jne .L24 .L19: addl $2, 8(%rsp) addl $2, %r10d cmpl 16(%rsp), %r10d jle .L29 ...