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

--- Comment #11 from Richard Biener <rguenth at gcc dot gnu.org> ---
(In reply to Alexander Monakov from comment #8)
> (In reply to jos...@codesourcery.com from comment #6)
> > For the standard, dynamically allocated case, you should only need to 
> > allocate enough memory to contain the initial part of the struct and the 
> > array members being accessed - not any padding after that array.  (There 
> > were wording problems before C99 TC2; see DR#282.)
> 
> I think the following testcase indicates that GCC assumes that tail padding
> is accessible:
> 
> struct S {
>       int i;
>       char c;
>       char fam[];
> };
> 
> void f(struct S *p, struct S *q)
> {
>       *p = *q;
> }
> 
> f:
>         movq    (%rsi), %rax
>         movq    %rax, (%rdi)
>         ret
> 
> Sorry for the tangential remark, but there seems to be a contradiction.

Not only accessible but also not used by sth else.  That is, a following
'char' variable may not be placed into the padding.

Reply via email to