------- Comment #5 from ppluzhnikov at google dot com 2009-05-06 16:36 ------- (In reply to comment #3)
> Note that this is likely not a problem in practice as > memcpy (p, p, sizeof (*p)) is difficult to implement > in a way that would make it not work. >From Julian Seward: JS> AIUI, POSIX says the src==dst case is not allowed (along with all other JS> overlapping cases) because (eg) on PowerPC, it is possible to make a high JS> performance memcpy that preallocates the destination area in D1 using JS> dcbz instructions, which create the line in D1 and fill it full of JS> zeroes. This avoids dragging the destination line up the memory JS> hierarchy only to completely overwrite it with stuff from the source. JS> JS> Result is however that if the src and dst overlap, in any way, including JS> completely, then this causes zeroes to be written into the src area (!) JS> which is certainly not what you want. This bug is likely fixed by: http://gcc.gnu.org/ml/gcc-patches/2009-04/msg00932.html -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32667