http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52238
Kai Tietz <ktietz at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |ktietz at gcc dot gnu.org --- Comment #2 from Kai Tietz <ktietz at gcc dot gnu.org> 2012-02-15 18:34:40 UTC --- in stor-layout.c function place_field() it is said "We already align ms_struct fields, so don't re-align them". This isn't completely true, as desired_align isn't handled in ms_struct case. Following patch seems to solve this issue: Index: stor-layout.c =================================================================== --- stor-layout.c (revision 184262) +++ stor-layout.c (working copy) @@ -1141,15 +1141,14 @@ } /* Does this field automatically have alignment it needs by virtue - of the fields that precede it and the record's own alignment? - We already align ms_struct fields, so don't re-align them. */ - if (known_align < desired_align - && !targetm.ms_bitfield_layout_p (rli->t)) + of the fields that precede it and the record's own alignment? */ + if (known_align < desired_align) { /* No, we need to skip space before this field. Bump the cumulative size to multiple of field alignment. */ - if (DECL_SOURCE_LOCATION (field) != BUILTINS_LOCATION) + if (!targetm.ms_bitfield_layout_p (rli->t) + && DECL_SOURCE_LOCATION (field) != BUILTINS_LOCATION) warning (OPT_Wpadded, "padding struct to align %q+D", field); /* If the alignment is still within offset_align, just align @@ -1302,7 +1301,7 @@ type size!) */ HOST_WIDE_INT bitsize = tree_low_cst (DECL_SIZE (field), 1); - if (rli->remaining_in_alignment < bitsize) + if (rli->remaining_in_alignment < bitsize) /* $$$$ */ { HOST_WIDE_INT typesize = tree_low_cst (TYPE_SIZE (type), 1);