https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68354
Martin Sebor <msebor at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Known to work| |7.0 Blocks| |69698 Resolution|--- |FIXED Known to fail| |5.3.0, 6.3.0 --- Comment #3 from Martin Sebor <msebor at gcc dot gnu.org> --- With GCC 7.0 and 6 the -Warray-bounds warning is gone. With GCC 7 and 5 (but not 6) the flexible array member is diagnosed with -Wpedantic. The internal representation of flexible array members has also changed with r231665: such members have a null domain, which is likely what has eliminated the -Warray-bounds warning. With this, although there still are many outstanding problems with flexible array members (see the meta-bug 69698), I think this bug can be resolved as fixed. $ cat y.c && gcc -O2 -S -Wall -Wextra -Wpedantic -xc++ y.c struct S { int n; int a[]; } s; int i; void f () { i = s.a [0]; } y.c:3:11: warning: ISO C++ forbids flexible array member ‘a’ [-Wpedantic] int a[]; ^ Referenced Bugs: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69698 [Bug 69698] [meta-bug] flexible array members