https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102151
Bug ID: 102151 Summary: Spurious warning by -Warray-bounds when allocating with flexible array member Product: gcc Version: 11.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: gniibe at fsij dot org Target Milestone: --- Created attachment 51392 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=51392&action=edit Test with smaller size and valid access to the structure with flexible array member When allocating memory with smaller size than sizeof(a_structure_with_flexible_member), for (valid) access to the structure, compiler emits spurious warning, in some optimization level.