https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86010
Martin Sebor <msebor at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |missed-optimization --- Comment #1 from Martin Sebor <msebor at gcc dot gnu.org> --- The difference is better seen in the assembly output for the two functions: g: .cfi_startproc subq $24, %rsp .cfi_def_cfa_offset 32 movq $0, 8(%rsp) leaq 8(%rsp), %rdi call f addq $24, %rsp .cfi_def_cfa_offset 8 ret .cfi_endproc h: .cfi_startproc subq $24, %rsp .cfi_def_cfa_offset 32 xorl %eax, %eax xorl %edx, %edx leaq 8(%rsp), %rdi movw %ax, 14(%rsp) movl $0, 8(%rsp) movw %dx, 12(%rsp) call f addq $24, %rsp .cfi_def_cfa_offset 8 ret .cfi_endproc Clang 6 emits the following: g(): push rax mov qword ptr [rsp], 0 mov rdi, rsp call f(void*) pop rax ret h(): push rax mov qword ptr [rsp], 0 mov rdi, rsp call f(void*) pop rax ret