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

            Bug ID: 61473
           Summary: register sized memmove not inlined
           Product: gcc
           Version: 4.10.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jtaylor.debian at googlemail dot com

in this example file compiled with gcc-4.10 -O3 inlines the memcpy, but not the
memmove:

#include <string.h>
void a(int *a, int *b)
{
    memcpy(a, b, sizeof(*a));
}

void b(int *a, int *b)
{
    memmove(a, b, sizeof(*a));
}


at least on x86 the integer can be stored in fully in a register and saved back
to arbitrary aligned memory, so it should not matter if the two address overlap
and gcc should be able to replace it with a much faster inline memcpy.
Currently gcc only inlines the memmove for 1 byte types.

I am using a recent svn copy of gcc:
$ gcc-4.10 --version
gcc (GCC) 4.10.0 20140605 (experimental)

Reply via email to