https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90376
Martin Sebor <msebor at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |diagnostic Status|NEW |RESOLVED Component|c |middle-end Blocks| |56456 Resolution|--- |INVALID --- Comment #2 from Martin Sebor <msebor at gcc dot gnu.org> --- The warning in this case points out that the memset call accesses memory outside the bounds of the subobject pointed to by the first argument. Making it explicit that the access is intended to span multiple members by passing to memset a pointer derived from the address of the enclosing object avoids the warning: void g (void) { static struct trace_iterator iter; __builtin_memset ((char*)&iter + __builtin_offsetof (struct trace_iterator, seq), 0, sizeof (struct trace_iterator) - __builtin_offsetof(struct trace_iterator, seq)); } Referenced Bugs: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56456 [Bug 56456] [meta-bug] bogus/missing -Warray-bounds