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

Henrik G. Olsson via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 21 11:02:38 PDT 2024


hnrklssn wrote:

Regarding there not being a `no-wraps` attribute. What happens with code like this? Is the attribute lost or casted away during the addition?
```
wrapping_int a = INT_MAX;
a = (int) a + 1;
```

Does it affect converting a number too large to fit in the target type?
```
wrapping_int a = INT_MAX;
wrapping_short b = a;
short c = a;
```

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


More information about the cfe-commits mailing list