https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96447
Bug ID: 96447 Summary: False positive -Wstringop-overflow with -O3 Product: gcc Version: 11.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: other Assignee: unassigned at gcc dot gnu.org Reporter: daniel at constexpr dot org Target Milestone: --- Created attachment 48990 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=48990&action=edit test.c The attached reduced test case results in the following false positive warning at -03 (but not -O2) without any additional compiler flags with both GCC 10.2.0 and GCC 11.0.0 (compiled from git today): test.c: In function ‘load’: test.c:23:25: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=] 23 | data[i] = get8u(s); | ~~~~~~~~^~~~~~~~~~ test.c:21:23: note: at offset 4 to object ‘data’ with size 4 declared here 21 | unsigned char data[4]; | ^~~~