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

--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Ah, I see, the problem is that the sanitizers use (both in GCC and Clang)
-fno-builtin option, which makes it not work unless user uses just memcpy.
Short testcase:
extern "C" void *memcpy (void *, const void *, decltype (sizeof 0)) __asm
("__sanitizer_internal_memcpy");
extern "C" void *memmove (void *, const void *, decltype (sizeof 0)) __asm
("__sanitizer_internal_memmove");
extern "C" void *memset (void *, int, decltype (sizeof 0)) __asm
("__sanitizer_internal_memset");

struct S { char s[512]; };

void
foo (S *p, S *q)

{
  *p = *q;
}

void
bar (int, void *r, void *s)
{
  memcpy (r, s, 512);
}

void
baz (int, int, void *t, void *u)
{
  __builtin_memcpy (t, u, 512);
}

On x86_64 -O2 -mstringop-strategy=libcall vs. that + -fno-builtin, on sparc
without -mstringop-strategy=libcall.

Reply via email to