Joseph S. Myers wrote:
> On Sun, 24 May 2009, Andrew Haley wrote:
> 
>> Of course we have to fix the assembler output.  For ant two declarations
>> a and b, &a != &b, even when a is a zero-length array.  So, you have to
>> allocate at least one byte.
> 
> I don't think this is necessarily part of the semantics for the GNU 
> extensions of zero-length arrays and empty structures.  Certainly when 
> they are used in the middle of a structure they are not expected to take 
> up any space (so their address may be the same as that of the next 
> member).

  But by the time you're outputting an assembler (common or bss) symbol, if
it's still size zero, that's the final size of the whole object.  You may want
internal parts of the object to compare equal, but I think the data object as
a whole shouldn't match any other.

struct {
  char vla1[0];
  char vla2[0];
} a;

struct {
  char vla3[0];
} b;

  We want &a.vla1 == &a.vla2, but we don't want &a == &b.  No?

    cheers,
      DaveK

Reply via email to