[clang] [lldb] [Clang] Introduce OverflowBehaviorType for fine-grained overflow control (PR #148914)

Justin Stitt via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 14 15:27:45 PDT 2025


JustinStitt wrote:

@kees

> If we don't follow what I'm describing, this becomes meaningless:
> 
> ```
> int __ob_trap big = runtime_1024;
> ...
> char __ob_wrap byte = big; // is this supposed to wrap or trap? I say wrap -- we're describing how "byte" behaves
> ```
> 
> How can we perform an assignment where we _want_ a wrapping behavior if suddenly `ob_trap` dominates even from the RHS?

FWIW, this doesn't compile


```c
$ cat test.c
void foo(int some) {
  int __ob_trap big = some;
  char __ob_wrap byte = big; // is this supposed to wrap or trap? I say wrap -- we're describing how "byte" behaves
}

$ clang test.c -foverflow-behavior-types -fsyntax-only

test.c:3:18: error: cannot assign between incompatible overflow behavior types ('__ob_wrap' and '__ob_trap')
    3 |   char __ob_wrap byte = big; // is this supposed to wrap or trap? I say wrap -- we're describing how "byte" behaves
      |                  ^
1 error generated.
```

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


More information about the cfe-commits mailing list