http://blog.llvm.org/2011/05/what-every-c-programmer-should-...
The TL;DR is that compilers compile code based on assumptions that UB won't be invoked. This sometimes produces extremely surprising results which have nothing to do with the hardware/OS.