[Bug c/46354] attribute((aligned(...))) can incorrectly decrease structure field alignment
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=46354 Luke changed: What|Removed |Added CC||lukebenes at hotmail dot com --- Comment #5 from Luke --- For the LLVM/Clang version of this bug, See: https://bugs.llvm.org/show_bug.cgi?id=9253
[Bug c/46354] attribute((aligned(...))) can incorrectly decrease structure field alignment
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=46354 Martin Sebor changed: What|Removed |Added Status|UNCONFIRMED |NEW Last reconfirmed||2016-01-26 CC||msebor at gcc dot gnu.org Ever confirmed|0 |1 Known to fail||4.5.3, 4.8.3, 4.9.3, 5.3.0, ||6.0 --- Comment #4 from Martin Sebor --- Confirmed. The documentation contradicts the implementation. See also the duplicate bug 65672 and bug 69502.
[Bug c/46354] attribute((aligned(...))) can incorrectly decrease structure field alignment
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46354 --- Comment #1 from pageexec at freemail dot hu 2010-11-07 22:43:33 UTC --- Created attachment 22314 -- http://gcc.gnu.org/bugzilla/attachment.cgi?id=22314 sample code to demonstrate structure field offsets
[Bug c/46354] attribute((aligned(...))) can incorrectly decrease structure field alignment
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46354 --- Comment #2 from Richard Guenther rguenth at gcc dot gnu.org 2010-11-07 23:00:25 UTC --- Generally GCC lays out structures based on the types of the elemets, not based on the alignment specified on fields. Which is why I think what you see is correct and intended.
[Bug c/46354] attribute((aligned(...))) can incorrectly decrease structure field alignment
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46354 --- Comment #3 from pageexec at freemail dot hu 2010-11-07 23:33:54 UTC --- (In reply to comment #2) Generally GCC lays out structures based on the types of the elemets, not based on the alignment specified on fields. according to the gcc docs, explicit alignment on structure fields *is* taken into account in that one can *increase* the natural alignment associated with a given type: The `aligned' attribute can only increase the alignment; but you can decrease it by specifying `packed' as well. See below. in this bug you can see that even without the packed attribute gcc can decrease the alignment. so either the docs or the implementation is buggy ;). the second issue is that when one does use the packed attribute on a structure, the resulting field alignment seems inconsistent depending on where the aligned attribute is (typedef vs. structure field). i don't see where the docs specify or imply this behaviour.