ahatanak wrote:

> If that mode doesn't already permit using unknown pointers and references in 
> all language modes, then we should change it so that it does. 
> `__builtin_object_size` is best-effort, but we should produce a constant 
> value for it that's not the `-1` or `0` fallback value whenever we're able to 
> do so.

But there isn't much we can do with unknown pointers or references, is there?

We can't have `foo` return 4 unless we know for sure that `s` isn't embedded in 
a larger object. In the following case, wouldn't `foo` be expected to return 12?

```
int bar() {
  S a[2];
  return foo(a[0]);
}
```

https://github.com/llvm/llvm-project/pull/95474
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to