https://stackoverflow.com/questions/36893251/why-does-the-enhanced-gcc-6-optimizer-break-practical-c-code https://gaultier.github.io/blog/the_production_bug_that_made_me_care_about_undefined_behavior.html Note that ubsan doesn't catch this: https://compiler-explorer.com/z/z8jx73ncf And the classic: https://compiler-explorer.com/z/bMGrsrEWs