UB effects on real world projects
summary
Shows concrete failures where compilers exploit UB to remove safety checks: Linux kernel left-shift UB removes zero check, strcpy calls lose null checks after optimization, and a double-unlock turns into an illegal x86 instruction tied to TSX errata. Porting exposes alignment differences that truncate copied bytes between Windows and Linux. Recommends running ubsan and the ISS-based interpreter and using compiler flags or bisecting compiler versions because optimizations based on UB routinely reorder or drop code and can break long-stable systems.
AI-written summary · about
chapters (11)
- 0:00Introduction to undefined behavior
- 1:48Culture and values behind UB
- 4:39Real-world UB bugs examples
- 9:40Runtime limitations with UB
- 13:41Tooling and UB detection limits
- 15:28Surprising UB in constructors
- 18:33Strict aliasing violations
- 21:01Less known UB cases
- 23:08Mitigations and solutions
- 24:56Performance vs UB trade-offs
- 25:17Key takeaways and conclusion
