https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113304
Bug ID: 113304 Summary: zero-length array and bound checking error Product: gcc Version: 13.2.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: sanitizer Assignee: unassigned at gcc dot gnu.org Reporter: marcandre.lureau at gmail dot com CC: dodji at gcc dot gnu.org, dvyukov at gcc dot gnu.org, jakub at gcc dot gnu.org, kcc at gcc dot gnu.org, marxin at gcc dot gnu.org Target Milestone: --- gcc (GCC) 13.2.1 20231205 (Red Hat 13.2.1-6) gcc -fsanitize=bounds-strict -lubsan test.c test.c:6:11: runtime error: index 3 out of bounds for type 'int [*]' typedef struct BN { int d[0]; } BN; void test(BN *foo) { foo->d[3] = 0; } int main(int argc, char *argv[]) { struct BN { int d[4]; } foo; test((BN *)&foo); return 0; } This coding style is used in bignum libraries, such as libtpms BN implementation. Is this incompatible with bounds-strict usage?