https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93538

--- Comment #2 from Martin Sebor <msebor at gcc dot gnu.org> ---
A better (well-defined) test case involves memmove:

$ cat a.c && gcc -O2 -S -Wall -fdump-tree-optimized=/dev/stdout -o/dev/stdout
a.c
struct A { char a[3]; };

void f (struct A *a)
{
  void *p = a;
  void *q = a->a;

  __builtin_memmove (p, q, sizeof (struct A));
}
        .file   "a.c"
        .text

;; Function f (f, funcdef_no=0, decl_uid=1932, cgraph_uid=1, symbol_order=0)

f (struct A * a)
{
  void * q;

  <bb 2> [local count: 1073741824]:
  q_2 = &a_1(D)->a;
  __builtin_memmove (a_1(D), q_2, 3); [tail call]
  return;

}


        .p2align 4
        .globl  f
        .type   f, @function
f:
.LFB0:
        .cfi_startproc
        movl    $3, %edx
        movq    %rdi, %rsi
        jmp     memmove
        .cfi_endproc
.LFE0:
        .size   f, .-f
        .ident  "GCC: (GNU) 10.0.1 20200131 (experimental)"
        .section        .note.GNU-stack,"",@progbits

Reply via email to