<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/96737>96737</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
How should `__builtin_object_size` treat casts in the `type & 1 == 1` case?
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
zygoloid
</td>
</tr>
</table>
<pre>
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.
_Originally posted by @bwendling in https://github.com/llvm/llvm-project/issues/96573#issuecomment-2190396880_
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJykVE1v4zYQ_TXUZRCDoiRaOuiQxPA2QItecjdG4kRilyJVkrJX--sL0psm3T3WMPil-XjvcTgYgp4sUc-aJ9acCtzi7Hz_fZ-ccVoVg1N7D__5vc46wO9fXv8ADHAjYw7wAjNeCRD-3ihE7Szg4LYIcSZgQoRteHDDXzRGJgSs6OMBTg5uBBgjLWuE6EDpMLor-ez04QErhghodxgxRG0nVp3hERYX9RXTHugbLqshVj0yfmL8fZT8_h_v-3FGD8v2jTVPJWfN6Ze5evrsvnpt4xsTLROCicYo1jzbvH6Gy2XYtInaXtRucdHj5Q71EvR3yi4yj23OycQjEx0T8kfyHznTJDrWPF3R5_UzlNmu-0DyTuEzsC_Pz5DBBWCStx2THJhobzPZdJCiSQ465GgHeLFZz3FGO1GAFyaOCyz4NQkX3c9aj2jGzWC6wZAQvcANbb6dgDvEGdOV6gBhdptRdxwpa0KR7AcacQv0c1idsf7KX3JAq8C6CAjO0oPSC9mgnUUD6D3uB3idyROMOd9AgH7aFkrsF1QEb87D4OIMbv0XdHCZpgKjv1LCPlEEupLfnSUmjgHcqm2yPnwW9vKn15O2aMwOqwuRFAw7sJoPN7LKJMG0hTnGNaRSE2cmzpOO8zYcRrcwcTbm-j49rN7dy_2sQ9goMHHuZHOsmKjyweiWxOJBlB2vOtm2_HJHAYXqK9VVHRbUl8eyq9q6Kcti7nHsqFSybis-tMe2qvmxaVDxpnur3zquCt0LLmouheTJqjzUKMeO6oYP1DRKCFZzWlCbQ4J4cH4qMpa-k8fqWBgcyITcB4SwdIP8MZV8cyp8n2kN2xRYzY0OMXxEiToa6n9zt_e6YJJ_vJHPb0NyiJ4w5rcckp65Q0ge9zV1CgklsOrEqhOUyXjEQKw6F5s3_f9RPvG79uKfAAAA__9g9YWB">