Counting Is Not Costing: How Much of a Compiler's Deleted Safety Checks Actually Matter
When an optimizing C compiler assumes that signed overflow, pointer overflow, and null dereference never occur, it may delete the checks a programmer wrote against those conditions. STACK (Wang et al., SOSP 2013) made this measurable at archive scale, reporting a count of code fragments to fix — easily read as a severity measure. We argue and measure that such a count overstates the operational cost. Compiling two versions each of SQLite, Lua, and zlib with and without the flags that restore these behaviors, and diffing the optimized GIMPLE by source location, we find 122 deleted guards. Classifying each by the input that could make it fire, and running the code where we can, we find only 2 that crafted input makes load-bearing: hand-written overflow checks whose deletion crashes Lua `unpack` (the overflow behind CVE-2025-46817 in Redis) or hangs SQLite `ieee754`. Another 37 fire only on a counter wrap, which we bound away for all but two; the remaining 83 we argue inert — differential, sanitizer, and fuzzing runs find no divergence where they reach them, though coverage is partial. Ten further libraries add about 14 deleted guards, none load-bearing. The count tracks cost poorly: zlib deletes 0 guards, SQLite 91, yet the demonstrated cost is 2. And whether even those 2 die depends on the compiler: gcc deletes both at −O1 and above, clang keeps one — a split a full clang census reproduces. Operational cost is a property of code × compiler × optimization level, not of the source alone.
Authors
- Utku Erol
Publication Details
- Journal
- Zenodo (CERN European Organization for Nuclear Research)
- Published
- 2026-11-29
- DOI
- https://doi.org/10.5281/zenodo.24648165
- Primary Topic
- Security and Verification in Computing
- Type
- preprint