[clang] Add documentation for `__builtin_object_size`. (PR #96573)
Bill Wendling via cfe-commits
cfe-commits at lists.llvm.org
Tue Jun 25 19:09:27 PDT 2024
bwendling wrote:
This LGTM as well. I have a question about the "sub-object" part. Do we attempt to discover the sub-object past any casting? A motivating example:
```c
char mux[10][10][10];
printf("%ld\n", __builtin_dynamic_object_size(&((char *)&mux[1][1])[var], 1));
```
GCC prints `89` (when `var` is 1). In the changes I'm making to the sub-object calculations, I want to say that this should print `9`, because the sub-object is `mux[1][1]` and not a one-dimensional array. There could be arguments made for both options, so I'd like to get everyone's opinions.
https://github.com/llvm/llvm-project/pull/96573
More information about the cfe-commits
mailing list