Comment on IDIV DoS (INT_MIN / -1)parentComments−kevinnk13yThe example the article gives isn't a general C problem, it's a common bug in some (mostly older) C/C++ compilers. As you point out GCC does not have this bug.−haberman13yIt's not a bug, it's intended to be undefined behavior; see http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html... (issue 1450)−mikeash13yRegardless of undefined behavior, it should not crash the compiler.−haberman13yAh, I missed that it can crash the tcc compiler. Yeah, that's a bug.−mikeash13yProbably easy to miss. One really does not expect the compiler to crash on code like that.
Comments
The example the article gives isn't a general C problem, it's a common bug in some (mostly older) C/C++ compilers. As you point out GCC does not have this bug.
It's not a bug, it's intended to be undefined behavior; see http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html... (issue 1450)
Regardless of undefined behavior, it should not crash the compiler.
Ah, I missed that it can crash the tcc compiler. Yeah, that's a bug.
Probably easy to miss. One really does not expect the compiler to crash on code like that.