------- Comment #5 from rguenth at gcc dot gnu dot org  2008-11-15 21:40 -------
The argument boils down to 6.5.6/8 which restricts pointer arithmetic on
objects
and 6.7.2.1/2 which forbids structures with an incomplete array at the end to
be a member of a structure or element of an array.  (This is all from the C99
standard - I do not have a C89 equivalent at hands)

GCC explicitly supports [0] for C89 as a way to get the C99 [] semantics.  GCC
also tries to support arbitrary trailing arrays as of flexible length for
legacy purposes.

Certainly

 struct {
   struct { char x[]; };
   char space[32];
 };

is not allowed by C99.  Replacing x[] with x[1] doesn't make it more valid.
If using a union doesn't work that's too bad - but the standard doesn't
explicitly allow that as an exception either (I now checked).

Note that for analyzing why we do not support this usage for legacy reasons
a (small) testcase to reproduce the failure is needed.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38136

Reply via email to