]> gcc.gnu.org Git - gcc.git/commitdiff
class.c (finish_struct_1): Force alignment of non-bitfields to BITS_PER_UNIT.
authorAndrew Haley <aph@cygnus.com>
Thu, 14 Oct 1999 10:49:23 +0000 (10:49 +0000)
committerAndrew Haley <aph@gcc.gnu.org>
Thu, 14 Oct 1999 10:49:23 +0000 (10:49 +0000)
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

gcc/cp/ChangeLog
gcc/cp/class.c

index 3593ce4bc0b48c5cd9d0b4ea5036e0301552929b..7cedc4a49356e45236b247ab65e4251d127b2e29 100644 (file)
@@ -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.
index d3801867e6713f907226fa6ee6d0a28f1fd4240b..f393a02bc189c75fbcef14b91247cee090647f76 100644 (file)
@@ -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);
+         }
        }
     }
 
This page took 0.090893 seconds and 5 git commands to generate.