From 7b04d839be54cd53637bcb425f69fd7f8e9a1aea Mon Sep 17 00:00:00 2001 From: jason Date: Tue, 11 Sep 2007 15:07:59 +0000 Subject: PR middle-end/27945 * stor-layout.c (layout_decl): Do pack variable size fields. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@128380 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/stor-layout.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) (limited to 'gcc/stor-layout.c') diff --git a/gcc/stor-layout.c b/gcc/stor-layout.c index ea658a86aa0..f149e68d537 100644 --- a/gcc/stor-layout.c +++ b/gcc/stor-layout.c @@ -414,18 +414,11 @@ layout_decl (tree decl, unsigned int known_align) else do_type_align (type, decl); - /* 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 the field is packed and not explicitly aligned, give it the + minimum alignment. 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)) + && !old_user_align) DECL_ALIGN (decl) = MIN (DECL_ALIGN (decl), BITS_PER_UNIT); if (! packed_p && ! DECL_USER_ALIGN (decl)) -- cgit v1.2.1