-Wstringop-overflow is documented to "Warn for calls to string manipulation functions such as memcpy and strcpy that are determined to overflow the destination buffer" but in GCC 11 it's issued even for user-defined functions that don't manipulate strings. GCC should issue -Warray-bounds for those instead. In addition, mentioning array indices rather than byte counts might make the warnings easier to interpret. $ cat z.c && gcc -O2 -S -Wall z.c void f (int[static 4]); void g (void) { int a[2]; f (a); } z.c: In function ‘g’: z.c:6:3: warning: ‘f’ accessing 16 bytes in a region of size 8 [-Wstringop-overflow=] 6 | f (a); | ^~~~~ z.c:6:3: note: referencing argument 1 of type ‘int *’ z.c:1:6: note: in a call to function ‘f’ 1 | void f (int[static 4]); | ^ Clang issues -Warray-bounds as expected: z.c:6:3: warning: array argument is too small; contains 2 elements, callee requires at least 4 [-Warray-bounds] f (a); ^ ~ z.c:1:12: note: callee declares array parameter as static here void f (int[static 4]); ^~~~~~~~~~ 1 warning generated.
Confirmed on Mark's behalf (CC'd).