> > When compiling the following the code with gcc 4.1.1 without > optimization, the output is wrong. > > gcc -v is > > Using built-in specs. > Target: i686-pc-linux-gnu > Configured with: ./configure --prefix=/home/jb/local > Thread model: posix > gcc version 4.1.1 > > <=====code=====> > > #include<stdio.h> > > int main() > { > int b[2] = {3, 5}; > > b[0] ^= b[1] ^= b[0] ^= b[1];
There is no sequence point between the assignments of b[0] so the behavior is undefined. -- Pinski