https://gcc.gnu.org/bugzilla/show_bug.cgi?id=38592
Thomas Koenig <tkoenig at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Component|fortran |tree-optimization --- Comment #8 from Thomas Koenig <tkoenig at gcc dot gnu.org> --- I think the best place to fix this is in the middle-end. Here is a C test case: int yes() { char a[3]; __builtin_memmove (a, "yes", 3); return __builtin_memcmp(a,"yes",3); } This generates a memcmp with current trunk: .LC0: .string "yes" .text .p2align 4,,15 .globl yes .type yes, @function yes: .LFB0: .cfi_startproc subq $24, %rsp .cfi_def_cfa_offset 32 movl $25977, %eax movl $3, %edx leaq 13(%rsp), %rdi movl $.LC0, %esi movw %ax, 13(%rsp) movb $115, 15(%rsp) call memcmp addq $24, %rsp .cfi_def_cfa_offset 8 ret .cfi_endproc .LFE0: .size yes, .-yes .ident "GCC: (GNU) 8.0.0 20170730 (experimental)" .section .note.GNU-stack,"",@progbits