Re: gcc gives inccorect value for simple expression

2016-04-22 Thread Kyrill Tkachov
On 22/04/16 14:01, c...@center.wakayama-u.ac.jp wrote: The following code, when compiled with gcc, it outputs "7". I have tried it with gcc-4.8.3 and gcc-6.0.1-20160415, both on x86_64 linux, with options -O0, -g, -O2. All of them gave the same answer. When compiled with clang, it gives 6. I

gcc gives inccorect value for simple expression

2016-04-22 Thread chen
The following code, when compiled with gcc, it outputs "7". I have tried it with gcc-4.8.3 and gcc-6.0.1-20160415, both on x86_64 linux, with options -O0, -g, -O2. All of them gave the same answer. When compiled with clang, it gives 6. I know that it is an ill coded program, but I still can't u