Nope. You're describing implementation-defined behavior. The compiler is free to assume undefined behavior
never happens, and optimize it away if it does. This can be a big problem, whether or not you are trying to write portable code.
This series (among many other places on the internet) does a good job explaining the problems http://blog.llvm.org/2011/05/what-every-c-programmer-should-...