https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104657
Bug ID: 104657 Summary: array subscript 0 is outside array bounds Product: gcc Version: 12.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: christophm30 at gmail dot com Target Milestone: --- Compiling the following code: void foo(unsigned long v) { volatile unsigned long *p; p = (void *)0x8; *p = v; } with GCC master and "-O2 -Wall" results in the following warning: $ gcc -O2 -Wall -c array_subscript_0.c array_subscript_0.c: In function 'foo': array_subscript_0.c:5:9: warning: array subscript 0 is outside array bounds of 'volatile long unsigned int[0]' [-Warray-bounds] 5 | *p = v; | ^~ This warning is unexpected and is not triggered by earlier versions of GCC. Possibly related: pr101977