This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Fix PR 5597
> Initialization of flexible array members is a gcc extension.
> You should have seen regressions in gcc.dg/array-[24].c when
> you ran the test suite.
Sorry... and I should have read more carefully the docs too.
What's the position of gcc with regard to the non-static initialization of
flexible array members ? In other words, would a patch that makes it illegal
and lets gcc pass the following test be acceptable ?
/* PR c/5597 */
/* { dg-do compile } */
/* { dg-options "" } */
/* Verify that GCC forbids non-static initialization of
flexible array members. */
struct str { int l; char s[]; };
struct str a = { 2, "a" };
void foo()
{
static struct str b = { 2, "b" };
struct str c = { 2, "c" }; /* { dg-error "non-static" } */
}
Btw, can't the ???? comment be removed line 4642 in c-decl.c, given that the
code exists in finish_struct() line 5775 ?
--
Eric Botcazou
ebotcazou@multimania.com