https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82694
--- Comment #4 from Markus Trippelsdorf <trippels at gcc dot gnu.org> --- Created attachment 42456 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=42456&action=edit unreduced testcase The unreduced testcase is attached. % /home/trippels/gcc_bad/usr/local/bin/gcc -fno-strict-overflow -O3 -S vsprintf.i vs. % /home/trippels/gcc_good/usr/local/bin/gcc -fno-strict-overflow -O3 -S vsprintf.i % diff -u vsprintf_good.s vsprintf_bad.s --- vsprintf_good.s 2017-10-24 10:57:50.797502298 +0200 +++ vsprintf_bad.s 2017-10-24 10:57:34.977480296 +0200 @@ -5711,7 +5711,6 @@ pushq %r14 .cfi_def_cfa_offset 24 .cfi_offset 14, -24 - movq %rsi, %r15 pushq %r13 .cfi_def_cfa_offset 32 .cfi_offset 13, -32 @@ -5722,67 +5721,55 @@ pushq %rbp .cfi_def_cfa_offset 48 .cfi_offset 6, -48 - leaq 2147483647(%rdi), %rbp pushq %rbx .cfi_def_cfa_offset 56 .cfi_offset 3, -56 - movq %rdx, %r12 - movq %rdi, %rbx + leaq 2147483647(%rdi), %r12 subq $40, %rsp .cfi_def_cfa_offset 96 - cmpq %rbp, %rdi - movq $0, 24(%rsp) - jbe .L846 cmpb $0, (%rsi) - movq %rdi, %rax - movq $-1, %rbp - notq %rax - movq %rax, (%rsp) - je .L847 + movq $0, 24(%rsp) + je .L925 + movq %rsi, %r14 + movq %rdx, %rbp + movq %rdi, %rbx .p2align 4,,10 .p2align 3 -.L925: +.L922: leaq 24(%rsp), %rsi - movq %r15, %rdi + movq %r14, %rdi call format_decode movzbl 24(%rsp), %edx movslq %eax, %rcx - leaq (%r15,%rcx), %r14 + leaq (%r14,%rcx), %r15 cmpb $7, %dl - ja .L848 - jmp *.L850(,%rdx,8) + ja .L847 + jmp *.L849(,%rdx,8) .section .rodata .align 8 .align 4 ... etc.