https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121044
Bug ID: 121044 Summary: False positive -Warray-bounds iwith GCC 14 and NEON intrinsics Product: gcc Version: 14.3.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: jpalus+gcc at fastmail dot com Target Milestone: --- Created attachment 61846 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=61846&action=edit reproducer Based on mbedtls build failure (upstream report https://github.com/Mbed-TLS/mbedtls/issues/9003) attached reproducer for false positive -Warray-bounds when targeting aarch64: $ gcc -O2 -Warray-bounds repro.c -c -o repro.o In function ‘xor’, inlined from ‘foo’ at repro.c:27:5: repro.c:19:17: warning: array subscript 48 is outside array bounds of ‘unsigned char[48]’ [-Warray-bounds=] 19 | r[i] = a[i] ^ b[i]; | ~^~~ repro.c: In function ‘foo’: repro.c:25:19: note: at offset 48 into object ‘tmp’ of size 48 25 | unsigned char tmp[48] = { 0 }; | ^~~ In function ‘xor’, inlined from ‘foo’ at repro.c:27:5: repro.c:19:14: warning: array subscript 48 is outside array bounds of ‘unsigned char[48]’ [-Warray-bounds=] 19 | r[i] = a[i] ^ b[i]; | ~~~~~^~~~~~~~~~~~~ repro.c: In function ‘foo’: repro.c:25:19: note: at offset 48 into object ‘tmp’ of size 48 25 | unsigned char tmp[48] = { 0 }; | ^~~ Note that it appears to affect GCC 14.x only (13.x/15.x seem to work fine according to godbolt).