Copied from URL: For anything bigger than -O1 it gives this output: > reimar at hokum ~ $ gcc -O2 bitbug.c -o bitbug > reimar at hokum ~ $ ./bitbug 0 1 > vals: 0 0 1 0 output should be > vals: 0 -1 1 0 If you can confirm that this is not only due to some breakage on my system, I think gcc 4.2.0 should be -amd64, since this is a quite trivial feature and it is completely broken. I will attach the sample C file shortly.
Created attachment 129116 [details] testcase that miscompiles for me
pa@loki ~ $ for optlevel in 0 1 2 s 3; do gcc -O${optlevel} bitbug.c -o bitbug&&./bitbug 0 1&&rm ./bitbug; done vals: 0 -1 1 0 vals: 0 1 1 0 vals: 0 0 1 0 vals: 0 0 1 0 vals: 0 0 1 0 This is on i686-pc-linux-gnu gcc 4.2.0
this is already known and fixed in gcc-4.2.1
gcc-4.2.1 in the tree