[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#324001: overlapping memcpy()



On 5/21/06, Thomas Dickey <dickey@radix.net> wrote:
On Sun, May 21, 2006 at 09:20:17AM +0200, Albert Cahalan wrote:
> That is indeed a serious error.

no - it's a stupid but benign error:
        source and destination addresses are the same

Consider this entirely reasonable implementation for PowerPC:

if 32-byte aligned, do fast copy
else if 8-byte aligned do double copy
else if 4-byte aligned do float copy
else do byte copy

Then, for each 32-byte cache line, the "fast copy" code does:

1. prefetch the source cache line
2. allocate the destination cache line as all zeroes
3. fetch the source cache line
4. store the destination cache line

End result: it acts like bzero() when src==dst



Reply to: