Dangerous Optimizations in C and C++ Programming Languages
summary
Compilers increasingly treat undefined behavior (UB) as a license for aggressive optimization, claiming wins from constant folding, loop‑invariant hoisting and induction‑variable rewrites but sometimes removing bounds checks or turning a finite loop into an infinite one. Concrete examples include the pointer+len overflow optimization that eliminates a bounds test at -O2 and GCC’s shifting diagnostics/flags (strict‑overflow deprecated in GCC 8). Practical mitigations shown are sanitizers (UBSan/ASan), auditing generated assembly, and a forthcoming TS6010 pointer provenance specification. Slides and code links are on the ACCU site.
AI-written summary · about
related talks
33mUndefined Behavior in C++: What Every Programmer Should Know and Fear
01h 27mDangerous Optimizations! in C++ - Part Deux
01h 04mRemoving Needless Undefined Behavior for a Safer C++
19mExploiting Undefined Behavior in C/C++ Programs for Optimization: A Study on the(…)
49mUndefined Behavior in 2017 (part 1 of 2)
01h 02mPractical Tips for Safer C++
05mDetecting Programs That Rely on Undefined Behavior
01h 02mBack To Basics: Undefined Behavior
