gcc complains about accessing the byte as ads->common.bytes[3] as that
field is declared as being one byte.
Details
Details
- Reviewers
mav - Commits
- rG5bd3ce4ef629: achiem: quiet gcc -Warray-bounds
env CROSS_TOOLCHAIN=amd64-gcc14 make buildkernel
Diff Detail
Diff Detail
- Repository
- rG FreeBSD src repository
- Lint
Lint Not Applicable - Unit
Tests Not Applicable
Event Timeline
Comment Actions
Sorry, not sure I follow. Are you referring to the index in ads->bytes?
% ctfdump -t /boot/kernel/kernel | grep -A 3 ses_status_array_dev_slot <4752> STRUCT ses_status_array_dev_slot (4 bytes) common type=3929 off=0 bytes type=521 off=8 % kgdb -q /boot/kernel/kernel Reading symbols from /boot/kernel/kernel... Reading symbols from /usr/lib/debug//boot/kernel/kernel.debug... (kgdb) ptype /o struct ses_status_array_dev_slot /* offset | size */ type = struct ses_status_array_dev_slot { /* 0 | 1 */ struct ses_status_common { /* 0 | 1 */ uint8_t bytes[1]; /* total size (bytes): 1 */ } common; /* 1 | 3 */ uint8_t bytes[3]; /* total size (bytes): 4 */ } (kgdb) set $ads = (struct ses_status_array_dev_slot *)0 (kgdb) p (uintptr_t)&$ads->common.bytes[3] $1 = 3 (kgdb) p (uintptr_t)&$ads->bytes[2] $2 = 3
Comment Actions
I'm sorry, you are right. I've mixed ses_status_array_dev_slot with ses_status_dev_slot.