------- Comment #8 from jason at gcc dot gnu dot org 2006-11-14 01:10 ------- Ah, I see the problem. The code I removed from the C and C++ front ends was redundant with code in layout_decl, except that the code in layout_decl deliberately ignores DECL_PACKED for fields of variable size.
/* If the field is of variable size, we can't misalign it since we have no way to make a temporary to align the result. But this isn't an issue if the decl is not addressable. Likewise if it is of unknown size. Note that do_type_align may set DECL_USER_ALIGN, so we need to check old_user_align instead. */ => if (packed_p && !old_user_align && (DECL_NONADDRESSABLE_P (decl) || DECL_SIZE_UNIT (decl) == 0 || TREE_CODE (DECL_SIZE_UNIT (decl)) == INTEGER_CST)) DECL_ALIGN (decl) = MIN (DECL_ALIGN (decl), BITS_PER_UNIT); This dates back to a change of Kenner's from 2001: Sat Dec 29 15:48:54 2001 Richard Kenner <[EMAIL PROTECTED]> * stor-layout.c (layout_decl): Don't misalign field of variable size for packed record. Richard, do you have any input? Do you think there a way to make that test more specific to the case were fixing? -- jason at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |kenner at vlsi1 dot ultra | |dot nyu dot edu AssignedTo|unassigned at gcc dot gnu |jason at gcc dot gnu dot org |dot org | Status|NEW |ASSIGNED Last reconfirmed|2006-06-09 07:45:54 |2006-11-14 01:10:19 date| | http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27945