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

--- Comment #8 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
The documentation is fairly clear that it affects that:
https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html
Although the size of a zero-length array is zero, an array member of this kind
may increase the size of the enclosing type as a result of tail padding.
The offset of a zero-length array member from the beginning of the enclosing
structure is the same as the offset of an array with one or more elements of
the same type. The alignment of a zero-length array is the same as the
alignment of its elements.

If there was no padding, the above would be violated, because { void* one; long
double two[1]; } also has the 8-byte padding in between.

See also
"Unlike a zero-length array which only contributes to the size of the enclosing
structure for the purposes of alignment"
part.

Reply via email to