diff options
author | jason <jason@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-09-11 15:07:59 +0000 |
---|---|---|
committer | jason <jason@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-09-11 15:07:59 +0000 |
commit | 7b04d839be54cd53637bcb425f69fd7f8e9a1aea (patch) | |
tree | 48637fd65b23c6ae1ebddac14a1328f463c9565c /gcc/stor-layout.c | |
parent | 3f382868f1e10cde9bb831905ba3f31de86e9d80 (diff) | |
download | gcc-7b04d839be54cd53637bcb425f69fd7f8e9a1aea.tar.gz |
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
Diffstat (limited to 'gcc/stor-layout.c')
-rw-r--r-- | gcc/stor-layout.c | 15 |
1 files changed, 4 insertions, 11 deletions
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)) |