https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79221
Martin Sebor <msebor at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Known to work| |10.0, 8.1.0, 9.2.0 Target Milestone|--- |8.4 Known to fail| |7.2.0 --- Comment #4 from Martin Sebor <msebor at gcc dot gnu.org> --- Looks like this was resolved by r255755 (PR 78918). Both functions in the test case in comment #0 are now diagnosed, by different warnings. That's not unexpected but should at some point be changed to issue -Wstringop-overflow for both. $ gcc -O2 -S -Wall pr79221.c pr79221.c: In function ‘f’: pr79221.c:8:3: warning: ‘strcat’ writing between 7 and 9 bytes into a region of size 3 overflows the destination [-Wstringop-overflow=] 8 | strcat (d, s); | ^~~~~~~~~~~~~ pr79221.c: In function ‘gf’: pr79221.c:15:3: warning: ‘__builtin_memcpy’ forming offset [3, 8] is out of the bounds [0, 3] of object ‘d’ with type ‘char[3]’ [-Warray-bounds] 15 | strcat (d, s); | ^~~~~~~~~~~~~ pr79221.c:3:6: note: ‘d’ declared here 3 | char d[3]; | ^