https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102295

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Note, we have other issues, consider:
struct A
{
  float a;
  int b[];
};

int x[4];
struct A c = { 42.0f, { ++x[0], ++x[1], ++x[2], ++x[3] } };
When splitting the init into DECL_INITIAL constant initializer and runtime
initialization, the flexible array member initialization is moved completely
into runtime initialization and nothing remains in DECL_INITIAL from it.  For
initializers of fields other than flexible array members that is ok, but by
getting rid of the flex array member initializer the size emitted for the var
in assembly doesn't include the flexible array member at all.  That is worse
than having too small .size, in this case it means overwriting whatever is
after the variable.  Small .size actually isn't wrong-code...

Reply via email to