Thomas Habets challenges the assumption that undefined behavior can at worst produce a segmentation fault. Examples using C++ std::unreachable and null-pointer dereferences show optimized code falling through into another function’s region or writing a value different from the source. These are particular GCC and Clang outputs, not a prediction that every build behaves identically. The key point is that compilers need not diagnose every instance, and an apparently expected result on one run does not make the program valid.
Back to Tech
Tech
Undefined behavior is not merely a guaranteed crash
C++ compiler examples show why source-level expectations do not determine the result.