This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Fix PR 5597
On Wed, Feb 13, 2002 at 05:57:55PM +0100, Eric Botcazou wrote:
> What's the position of gcc with regard to the non-static initialization of
> flexible array members?
Illegal.
> In other words, would a patch that makes it illegal
> and lets gcc pass the following test be acceptable ?
Yes.
> struct str c = { 2, "c" }; /* { dg-error "non-static" } */
Should also try compond literal init:
struct str d = (struct str) { 2, "d" };
struct str e = (struct str) { d.len, "e" };
This is a bit weirder in that the compound literal is an unnamed object
and so D may be placed in static storage (which might succeed based on
gcc's extension), but E must be constructed at runtime. For consistency,
I think both should fail.
> Btw, can't the ???? comment be removed line 4642 in c-decl.c, given
> that the code exists in finish_struct() line 5775 ?
IIRC, the code at line 5775 is not complete. But the comment should
be removed and ??? notes for what's left to be checked should be added
to finish struct.
r~