[clang] [Clang] Add wraps attribute (for granular integer overflow handling) (PR #86618)

Kees Cook via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 29 08:49:17 PDT 2024


kees wrote:

My thinking about this attribute tends to follow from my desire not to change the C type system, but rather to adjust the behavior of the sanitizers. This means that it is possible to still build the Linux kernel without the sanitizers (the build just ignores the attribute), or with (where the attribute now has meaning). I feel like adding new types is a much larger/different thing, as it ends up requiring that the core language has to do something specific about overflow, etc. Under the sanitizers, there is a well-defined behavioral modification for overflow. Having the attribute augment the sanitizer means the semantics of regular C remain unchanged. We could even go so far as making it an error to encounter the attribute when the sanitizers aren't enabled.

https://github.com/llvm/llvm-project/pull/86618


More information about the cfe-commits mailing list