This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: bug in 4.1.1?


> 
> 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]