[RFC] strcpy optimizations

Paul Eggert eggert@cs.ucla.edu
Tue Jan 29 22:15:00 GMT 2013


On 01/29/13 13:53, Ondřej Bílka wrote:
> I wanted to use it only to bytes which change.

Sorry, I don't follow.

> There is problem with code like this:
> struct foo {
>   long x;
>   char y[8];
>   long z;
> }
> foo f;
> 
> With f.x++;              in first thread
> With f.z++;              in second thread
> and  strcpy (f.y, "abc") in third thread.

The behavior of strcpy is undefined in that case.
So strcpy can do whatever it likes, and
that includes using the pblendvb instruction.



More information about the Libc-alpha mailing list