[clang] [Clang][counted_by] Load the count through unions by byte offset (PR #228309)
Justin Stitt via cfe-commits
cfe-commits at lists.llvm.org
Mon Oct 12 11:02:17 PDT 2026
https://github.com/JustinStitt requested changes to this pull request.
im getting a crash when messing around with bitfields:
```c
struct there_be_bitfields_in_these_woods {
unsigned pad : 13;
unsigned count : 13;
int fam[] __attribute__((counted_by(count)));
};
void set(struct there_be_bitfields_in_these_woods *p, unsigned n) {
*__builtin_counted_by_ref(p->fam) = n;
}
```
sema should probably reject a bit-field for counted_by? unless we have users for this 😬
https://github.com/llvm/llvm-project/pull/228309
More information about the cfe-commits
mailing list