[clang] [lldb] [Clang] Introduce OverflowBehaviorType for fine-grained overflow control (PR #148914)
Kees Cook via cfe-commits
cfe-commits at lists.llvm.org
Tue Oct 14 11:14:43 PDT 2025
kees wrote:
@JustinStitt were looking over things, and I stumbled over something here...
> Thanks. So IIUC, the rule is:
>
> 1. If the type of either operand of an arithmetic operator is `__ob_trap`, the operator traps on overflow, and the result type is `__ob_trap`.
This is correct and what I was expecting.
> 2. If either the operand type or the destination type of an integer conversion is `__ob_trap`, the conversion traps on overflow.
This one, however, I think it not what we want, but I may be missing something.
```
int __ob_trap src = bigger_than_255;
...
char dest = src;
```
I don't think we want a trap on the `dest` assignment, since it isn't `__ob_trap`. It doesn't care about the truncation. This is a "sided" operation, unlike the arithmetic.
https://github.com/llvm/llvm-project/pull/148914
More information about the cfe-commits
mailing list