This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/79319] sizeof returns the wrong size of a union containing aligned members


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

--- Comment #3 from Marc Glisse <glisse at gcc dot gnu.org> ---
It is a bit confusing indeed that vec4_t has sizeof: 16 and _Alignof: 32, one
might expect an invariant that sizeof >= _Alignof... But just a typedef doesn't
increase the size, while stuffing it in a struct/union does. And indeed if I
try to make an array of vec4_t, I get the error: alignment of array elements is
greater than element size. clang gives the same output on your program, and
seems to ignore alignment if I make an array of vec4_t.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]