https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116736
Bug ID: 116736 Summary: missing diagnostic for out-of-bounds array access Product: gcc Version: 15.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: middle-end Assignee: unassigned at gcc dot gnu.org Reporter: bruno at clisp dot org Target Milestone: --- Created attachment 59122 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=59122&action=edit test case foo.c >From the description of -Warray-bounds and -fstrict-flex-arrays in https://gcc.gnu.org/onlinedocs/gcc-14.2.0/gcc/Warning-Options.html, as well as the presentation by Qing Zhao about the 'counted_by' attribute at the GNU Tools Caudron 2024 (2024-09-14), I would have expected to get a warning for the out-of-bounds access in this compilation: $ gcc -I. foo.c -O2 -W -Wall -Warray-bounds=2 -fstrict-flex-arrays=3 Expected result: A warning about line 15: int x = p->element[1]; Actual result: No diagnostic.