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 understand why it outputs 7 when compiled by gcc. /******************************************/ #include <stdio.h> int main() { int i; i = 0; printf("%d\n", (++i) + (++i) + (++i)); return 0; }