aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Haley <aph@cygnus.com>1999-10-14 10:49:23 +0000
committerAndrew Haley <aph@gcc.gnu.org>1999-10-14 10:49:23 +0000
commite7bba992a94b62c152798dcfcde52b1f9b442398 (patch)
tree357a2fbff7846d81a1e7988a62ef478e0a6b9bf3
parentc76aab113efa6c69e438d16581ae66a0fa13cc62 (diff)
downloadgcc-e7bba992a94b62c152798dcfcde52b1f9b442398.zip
gcc-e7bba992a94b62c152798dcfcde52b1f9b442398.tar.gz
gcc-e7bba992a94b62c152798dcfcde52b1f9b442398.tar.bz2
class.c (finish_struct_1): Force alignment of non-bitfields to BITS_PER_UNIT.
1999-10-13 Andrew Haley <aph@cygnus.com> * class.c (finish_struct_1): Force alignment of non-bitfields to BITS_PER_UNIT. From-SVN: r29973
-rw-r--r--gcc/cp/ChangeLog5
-rw-r--r--gcc/cp/class.c8
2 files changed, 13 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 3593ce4..7cedc4a 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,8 @@
+1999-10-13 Andrew Haley <aph@cygnus.com>
+
+ * class.c (finish_struct_1): Force alignment of non-bitfields to
+ BITS_PER_UNIT.
+
Wed Oct 13 22:01:35 1999 J"orn Rennecke <amylaar@cygnus.co.uk>
* typeck2.c (process_init_constructor): Handle empty constructors.
diff --git a/gcc/cp/class.c b/gcc/cp/class.c
index d380186..f393a02 100644
--- a/gcc/cp/class.c
+++ b/gcc/cp/class.c
@@ -3654,6 +3654,14 @@ finish_struct_1 (t)
cp_error_at ("multiple fields in union `%T' initialized");
any_default_members = 1;
}
+
+ {
+ unsigned int min_align = (DECL_PACKED (x) ? BITS_PER_UNIT
+ : TYPE_ALIGN (TREE_TYPE (x)));
+ /* Non-bit-fields are aligned for their type, except packed
+ fields which require only BITS_PER_UNIT alignment. */
+ DECL_ALIGN (x) = MAX (DECL_ALIGN (x), min_align);
+ }
}
}