stor-layout.c (layout_decl): Do not bump the alignment of a bit-field to more than...
authorEric Botcazou <ebotcazou@adacore.com>
Mon, 25 Feb 2008 09:55:26 +0000 (09:55 +0000)
committerEric Botcazou <ebotcazou@gcc.gnu.org>
Mon, 25 Feb 2008 09:55:26 +0000 (09:55 +0000)
* stor-layout.c (layout_decl): Do not bump the alignment of a
bit-field to more than byte alignment if it is packed.

From-SVN: r132614

gcc/ChangeLog
gcc/stor-layout.c

index eac3fe2ba1c8ab54ef834957b77610db362f3be7..f9243950066b500a15a02b9bf7a90fb4e5a1821a 100644 (file)
@@ -1,3 +1,8 @@
+2008-02-25  Eric Botcazou  <ebotcazou@adacore.com>
+
+       * stor-layout.c (layout_decl): Do not bump the alignment of a
+       bit-field to more than byte alignment if it is packed.
+
 2008-02-24  David Edelsohn  <edelsohn@gnu.org>
 
        * config/rs6000/rs6000.c (processor_costs): Add cache costs for
index 1ae2db5ca002730d3f12c0bd64d8aba5fc65f974..a7bcd054400fe6e5ad66ff78a6eff23d9c766224 100644 (file)
@@ -388,13 +388,13 @@ layout_decl (tree decl, unsigned int known_align)
            {
              enum machine_mode xmode
                = mode_for_size_tree (DECL_SIZE (decl), MODE_INT, 1);
+             unsigned int xalign = GET_MODE_ALIGNMENT (xmode);
 
              if (xmode != BLKmode
-                 && (known_align == 0
-                     || known_align >= GET_MODE_ALIGNMENT (xmode)))
+                 && !(xalign > BITS_PER_UNIT && DECL_PACKED (decl))
+                 && (known_align == 0 || known_align >= xalign))
                {
-                 DECL_ALIGN (decl) = MAX (GET_MODE_ALIGNMENT (xmode),
-                                          DECL_ALIGN (decl));
+                 DECL_ALIGN (decl) = MAX (xalign, DECL_ALIGN (decl));
                  DECL_MODE (decl) = xmode;
                  DECL_BIT_FIELD (decl) = 0;
                }