https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90525
Bug ID: 90525 Summary: Wrong offsets in warning text for -Warray-bounds (with subobject) Product: gcc Version: 9.1.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: miguel.ojeda.sandonis at gmail dot com Target Milestone: --- When fixing an -Warray-bounds warning for the kernel I noticed that the offsets were off-by-1 in at least one of the warning texts. For instance: struct T { char a, b, c; } t; void f(void) { __builtin_memset(&t.a, 0, 3); } gives: x.c: In function 'f': x.c:2:16: warning: '__builtin_memset' offset [2, 3] from the object at 't' is out of the bounds of referenced subobject 'a' with type 'char' at offset 0 [-Warray-bounds] 2 | void f(void) { __builtin_memset(&t.a, 0, 3); } | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ Instead of [2, 3], it should be [1, 2].