https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119429
--- Comment #11 from Jonathan Wakely <redi at gcc dot gnu.org> --- Clang documents how to silence these diagnostics, which are NOT undefined behaviour. The conversion to size_t is 100% portable and well defined by the standard. I wrote it that way intentionally, and it behaves exactly as it's supposed to. https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html#silencing-unsigned-integer-overflow