https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92815
Martin Sebor <msebor at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |diagnostic Status|UNCONFIRMED |NEW Last reconfirmed| |2019-12-05 Blocks| |88443 Summary|spurious |[8/9/10 Regression] |-Wstringop-overflow writing |spurious |into a flexible array of an |-Wstringop-overflow writing |extern struct |into a flexible array of an | |extern struct Ever confirmed|0 |1 --- Comment #1 from Martin Sebor <msebor at gcc dot gnu.org> --- The full test case is: struct S { int n; char ax[]; }; extern struct S s /* = { 5, { 1, 2, 3, 4, 5 } } */; void g (void) { __builtin_strcpy (s.ax, "123"); } The false positive warning has been issued since r243419 (GCC 7.0): r243419 | msebor | 2016-12-07 19:01:33 -0500 (Wed, 07 Dec 2016) | 68 lines PR c/53562 - Add -Werror= support for -D_FORTIFY_SOURCE / __builtin___memcpy_chk PR middle-end/77784 - duplicate warning for snprintf when n > object size PR middle-end/78149 - missing warning on strncpy buffer overflow due to an excessive bound PR middle-end/78138 - missing warnings on buffer overflow with non-constant source length Referenced Bugs: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88443 [Bug 88443] [meta-bug] bogus/missing -Wstringop-overflow warnings