On Wed, Mar 14, 2018 at 02:08:07PM +0100, Martin Liška wrote: > > diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/mempcpy.c > > b/gcc/testsuite/gcc.c-torture/execute/builtins/mempcpy.c > > index d82e2232d7b..91e1c87f83f 100644 > > --- a/gcc/testsuite/gcc.c-torture/execute/builtins/mempcpy.c > > +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/mempcpy.c > > @@ -62,7 +62,7 @@ main_test (void) > > mempcpy (p + 5, s3, 1); > > if (memcmp (p, "ABCDEFg", 8)) > > abort (); > > - mempcpy (p + 6, s1 + 1, l1); > > + memcpy (p + 6, s1 + 1, l1); > > if (memcmp (p, "ABCDEF2", 8)) > > abort (); > > } > > > > This is a mempcpy test. Why is mempcpy changed to memcpy? > > > > Because this mempcpy is not optimized out to memcpy and it then aborts.
Why it isn't optimized to memcpy? If the lhs is unused, it always should be folded to memcpy, regardless of whether mempcpy is fast or not (I assume no target has slow memcpy and fast mempcpy). Jakub