On 12/11/13 12:19, Eric Botcazou wrote:
Yes we do, even for struct { struct { int a; char a[1] } }; (note the not
really "trailing" as there is padding after the trailing array). We do
take size limitations from a DECL (if we see one) into account to limit the
effect of this trailing-array-supporting, so it effectively only applies to
indirect accesses (and the padding example above, you can use the whole
padding if DECL_SIZE allows that).
OK, so we want the attached patch? FWIW it passed
make -k check-c check-c++ RUNTESTFLAGS="compat.exp struct-layout-1.exp"
on x86/Linux, x86-64/Linux, PowerPC/Linux [*], IA-64/Linux, SPARC/Solaris and
SPARC64/Solaris with ALT_CC_UNDER_TEST set to the unpatched compiler.
[*] the failures (DFP related) are the same as with the unpatched compiler.
Does this catch C99 VLAs? I vaguely recall we have a different internal
representation of those?!? And don't those have the same problem?
[I've been meaning to research the different ways we represent trailing
arrays/VLAs, but haven't had the time yet. ]
I think this patch is a good one, but I'm not sure it's 100% complete yet.
jeff