cp = 'A';
cp = 'B';
cp ^= (cp^=(cp^=cp));
The complex byte swapping instruction is far fetched but seems legal.
It actually swaps bytes if compiled with "gcc -O3". Without optimization,
one of the bytes receives a '\0'.
This instruction seemed to work properly with versions 3.
System: Linux lpnp204 2.4.21-47.0.1.EL.cernsmp #1 SMP Thu Oct 19 16:35:52 CEST 2006 i686 i686 i386 GNU/Linux
configured with: ./configure
Compile the code above with various degrees of optimization.
You are modifying the same object twice between two sequence points.
*** This bug has been marked as a duplicate of 11751 ***