Re: [PATCH] gcc_qsort: avoid overlapping memcpy (PR 86311)

2018-06-25 Thread Alexander Monakov
On Mon, 25 Jun 2018, Richard Biener wrote: >> Sigh - I see GCC optimizes memmove as well as memcpy in this case, so >> changing the offending memcpy calls to memmoves would be a bit cleaner. OK to >> go with this instead? > > I think that's better. Or conditionalizing the offending ones on dest! =

Re: [PATCH] gcc_qsort: avoid overlapping memcpy (PR 86311)

2018-06-25 Thread Richard Biener
On June 25, 2018 4:52:43 PM GMT+02:00, Alexander Monakov wrote: >On Mon, 25 Jun 2018, Alexander Monakov wrote: >> >> In PR 86311 Valgrind flags a call to memcpy with overlapping buffers. >This can >> happen in reorder{23,45} helpers when we're reordering in-place, and >the 3rd/5th >> element doe

Re: [PATCH] gcc_qsort: avoid overlapping memcpy (PR 86311)

2018-06-25 Thread Alexander Monakov
On Mon, 25 Jun 2018, Alexander Monakov wrote: > > In PR 86311 Valgrind flags a call to memcpy with overlapping buffers. This can > happen in reorder{23,45} helpers when we're reordering in-place, and the > 3rd/5th > element doesn't need to be moved: in that case the middle memcpy is called > with

[PATCH] gcc_qsort: avoid overlapping memcpy (PR 86311)

2018-06-25 Thread Alexander Monakov
Hi, In PR 86311 Valgrind flags a call to memcpy with overlapping buffers. This can happen in reorder{23,45} helpers when we're reordering in-place, and the 3rd/5th element doesn't need to be moved: in that case the middle memcpy is called with source == destination. The fix is simple: just use a