http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28865
--- Comment #19 from Alan Modra <amodra at gmail dot com> ---
Jakub, you're correct. I should have read the standard on flexible array
members before poking at this bug last year. Nick's patch is looking good to
me.
ISO/IEC 9899:1999 is quite clear that the answer to comment #2 is that sizeof
does *not* include the flexible array component (but it does include any
padding needed to align the start of the flexible array). I think it is
reasonable to do the same for .size and not include the flexible array
component there too.
The testcase (which is invalid code IMO) in comment #3 hits this assert in
varasm.c:
/* Advance to offset of this element.
Note no alignment needed in an array, since that is guaranteed
if each element has the proper size. */
if ((local->field != NULL_TREE || local->index != NULL_TREE)
&& fieldpos != local->total_bytes)
{
gcc_assert (fieldpos >= local->total_bytes);