[clang] [Clang] Add wraps attribute (for granular integer overflow handling) (PR #86618)
Bill Wendling via cfe-commits
cfe-commits at lists.llvm.org
Thu Apr 11 12:21:43 PDT 2024
bwendling wrote:
> Forbidding usage in C++ probably avoids the worst of the canonical-type issues, but there's still some potential for weird results. Particularly with type merging; for example, if you write `a ? (wrap_int)x : 1`, is the result a wrapping type?
I had a similar question in the general case: is the annotation contagious?
```
int foo(wrap_int x, int a, int b, int c) {
if (x + a + b < c)
return 0;
return 1;
}
```
The `x + a` is checked, but is that result checked when added to `b`?
https://github.com/llvm/llvm-project/pull/86618
More information about the cfe-commits
mailing list