Detecting Programs That Rely on Undefined Behavior
summary
Undefined behavior can cause observable wrong output: a small snippet dereferencing past a std::array index prints garbage yet compilers give no warning; clang-tidy flags it and ASAN and UBSAN catch it at runtime (together they both fail fast). Another case: calling mktime on an uninitialized struct tm crosses a C library boundary and produces wrong results about half the time; clang-tidy points to Core Guidelines and Valgrind reliably finds the uninitialized memory. Use static checks plus dynamic sanitizers at different optimization levels.
AI-written summary · about
chapters (7)
- 0:00Intro
- 0:22Undefined Behavior
- 1:09First Example
- 2:12Tools
- 2:47Toy Problem
- 3:57Clanked ID
- 4:43Conclusions
related talks
49mUndefined Behavior in 2017 (part 1 of 2)
01h 04mRemoving Needless Undefined Behavior for a Safer C++
26mUndefined Behavior in 2017 (part 2 of 2)
57mUndefined Behavior is Not an Error
01h 30mDangerous Optimizations in C and C++ Programming Languages
19mLightning Talk: Your Favorite Undefined Behavior in C++
15mC++ WAT
01h 27mDangerous Optimizations! in C++ - Part Deux
