summaryrefslogtreecommitdiff
path: root/gcc/c-decl.c
diff options
context:
space:
mode:
authornathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4>2005-11-28 10:34:30 +0000
committernathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4>2005-11-28 10:34:30 +0000
commitc2ab04f9e57d248094640e87fdfe3f9454a9cd5d (patch)
tree7e925b64a93bd395a2f07912807080dfbe0ecd38 /gcc/c-decl.c
parent4e62d878778233548fdf5049e7a2b621b88928ee (diff)
downloadgcc-c2ab04f9e57d248094640e87fdfe3f9454a9cd5d.tar.gz
.:
PR c++/21166 * c-decl.c (finish_struct): Only set DECL_PACKED on a field when its natural alignment is > BITS_PER_UNIT. * stor-layout.c (finalize_type_size): Revert my patch of 2005-08-08. * c-common.c (handle_packed_attribute): Ignore packing on a field whose type is naturally char aligned. cp: PR c++/21166 * class.c (check_field_decls): Only set DECL_PACKED on a field when its natural alignment is > BITS_PER_UNIT. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@107599 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/c-decl.c')
-rw-r--r--gcc/c-decl.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/gcc/c-decl.c b/gcc/c-decl.c
index a86cfdc01b6..44e03abacdc 100644
--- a/gcc/c-decl.c
+++ b/gcc/c-decl.c
@@ -5326,7 +5326,9 @@ finish_struct (tree t, tree fieldlist, tree attributes)
for (x = fieldlist; x; x = TREE_CHAIN (x))
{
DECL_CONTEXT (x) = t;
- DECL_PACKED (x) |= TYPE_PACKED (t);
+
+ if (TYPE_PACKED (t) && TYPE_ALIGN (TREE_TYPE (x)) > BITS_PER_UNIT)
+ DECL_PACKED (x) = 1;
/* If any field is const, the structure type is pseudo-const. */
if (TREE_READONLY (x))