http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52991
--- Comment #10 from Kai Tietz <ktietz at gcc dot gnu.org> 2012-12-18 21:35:27 UTC --- (In reply to comment #9) > It doesn't look to me that the first two hunks of the patch are needed. Yes, that's right. > The last hunk doesn't look like it should be considering either TYPE_PACKED > of the parent structure, or TYPE_ALIGN of the field type, but rather > using DECL_ALIGN of the field. Which ought already have been assigned > by layout_decl via update_alignment_for_field. Well, nothing considers TYPE_PACKED of the parent structure for ms_struct. The field's type-alignment needs to be considered for checking, if type has user-specified alignment AFAICS. > The biggest problem to me appears to be the entire ms_bitfield_layout_p > block of code there, whose block comments talk about adjusting bitfields, > and yet is firing for structures that contain no bitfields at all. That > tells me that the logic higher in the block (or elsewere wrt > bitfield_layout_p) > is in error. That isn't the fully story for ms_struct here, the ms_biffield_layout_p block has as internal packing of same-types - that's not related to aligned or packed attributes at all - and needs to be done dependent to its offset, when type's offset is known. So there is no logical-error in this code, beside. Nevertheless I admit that the ms_struct code-path and the gnu_struct code-path could win by separating them, and for both some documention about used schema in source would be great. In general it would be great to have somebody with a VC, who would be willing to compile some test-cases by this VC. The documention about structure-layout on msdn it pretty poor and most stuff needs to be collected or done via best-guess. User-specified alignment within structures (not via #pragma pack) seems to be introduced in recent VC versions, so tester should have a modern version.