https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80491
--- Comment #2 from Victor Khimenko <khim at google dot com> --- An interesting observation: -O1 actually produces perfect code: $ gcc -S -O1 test.cc -o- .file "test.cc" .text .p2align 4,,15 .globl _Z3addR4pairS0_ .type _Z3addR4pairS0_, @function _Z3addR4pairS0_: .LFB4: .cfi_startproc movq (%rdi), %rax movq 8(%rsi), %rdx addq (%rsi), %rax adcq 8(%rdi), %rdx ret .cfi_endproc .LFE4: .size _Z3addR4pairS0_, .-_Z3addR4pairS0_ .ident "GCC: (GNU) 7.0.1 20170307 (experimental)" .section .note.GNU-stack,"",@progbits For some reason incrased optimization levels make code significantly worse here.