andersch.dev

<2024-06-17 Mon>

Clang

Clang is a compiler for C, C++ and Objective-C. It is built on an LLVM back-end.

UndefinedBehaviorSanitizer (UBSan)

Clang comes with is a runtime undefined behavior detector called UBSan. It can detect:

  • Array subscript out of bounds, where the bounds can be statically determined
  • Bitwise shifts that are out of bounds for their data type
  • Dereferencing misaligned or null pointers
  • Signed integer overflow
  • Conversion to, from, or between floating-point types which would overflow the destination

To enable usage, compile with -fsanitize=undefined

Resources