Check http://en.cppreference.com/w/cpp/language/eval_order especially the part which discusses “Undefined behavior”. Basically it’s not a bug in the compiler. The language says what you’re doing is undefined.
solved Compiler issue or some bug in code block of c [duplicate]