Don't look UB: Exposing sanitizer-eliding compiler optimizations

Raphael Isemann, Cristiano Giuffrida, Herbert Bos, Erik van der Kouwe, Klaus von Gleissenthall
[doi] [Google Scholar] [DBLP] [Citeseer] [url]

Proc. ACM Program. Lang. 7(PLDI)
Association for Computing Machinery
New York, NY, USA
jun 2023
Note(s): undefined behaviour, sanitizer

This is about the conflict between compiler optimizations and sanitizers. Compiler optimizations exploit UB behavior to optimize code and, in the process, they can transform UB code to well-defined code by picking an arbitrary interpretation for the code. Sanitizers introduce additional runtime checks into code to detect UB behavior. Obviously, sanitizers cannot detect UB that has been elided by a compiler optimization.

This paper uses differential testing to understand where this happens in LLVM.