https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80114
--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> --- I see, with -O2 and your options: main: .LFB0: .cfi_startproc movl $1, -4(%rsp) movslq -4(%rsp), %rax movl ._1(,%rax,4), %eax ret which is the same as without. Similar for using GCC instead of G++.