The alignment of an anonymous structure defined as a member of another structure (thanks to -fms-extensions) cannot be forced with __attribute__((aligned)).
This problem occurs on cygwin with default gcc packages: gcc version 4.3.2 20080827 (alpha-testing) 1 (GCC) and: gcc version 3.4.4 (cygming special, gdc 0.12, using dmd 0.125) The code below show the exact problem by comparing the sizes and alignments of a named struct and an anonynous one. ---------------------------------------------------------------------------- #include <stdio.h> struct nested { char a; char b; }; struct unaligned { char misalign; struct nested __attribute__((aligned(4))); }; struct aligned { char misalign; struct nested name __attribute__((aligned(4))); }; int main(int argc, char * argv[]) { printf("%d %d - %d %d\n", sizeof(struct unaligned), sizeof(struct aligned), __alignof__(struct unaligned), __alignof__(struct aligned)); } ---------------------------------------------------------------------------- options: gcc-4 -std=c99 -fms-extensions align.c ---------------------------------------------------------------------------- output: 3 8 - 1 4 ---------------------------------------------------------------------------- -- Summary: aligned attribute not working on ms-extensions anonymous struct Product: gcc Version: 4.3.2 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: acalando at free dot fr http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38845