stor-layout.c (layout_decl): Check DECL_PACKED before calling ADJUST_FIELD_ALIGN.
authorDaniel Jacobowitz <drow@mvista.com>
Mon, 19 Apr 2004 18:02:40 +0000 (18:02 +0000)
committerDaniel Jacobowitz <drow@gcc.gnu.org>
Mon, 19 Apr 2004 18:02:40 +0000 (18:02 +0000)
* stor-layout.c (layout_decl): Check DECL_PACKED before calling
ADJUST_FIELD_ALIGN.  Check maximum_field_alignment after.

From-SVN: r80860

gcc/ChangeLog
gcc/stor-layout.c

index 3bd73fee5e5297ef65e5bd78c0e4caed29f068ef..198314a3f7a6a116002237402625c4ee6908cbbd 100644 (file)
@@ -1,3 +1,8 @@
+2004-04-19  Daniel Jacobowitz  <drow@mvista.com>
+
+       * stor-layout.c (layout_decl): Check DECL_PACKED before calling
+       ADJUST_FIELD_ALIGN.  Check maximum_field_alignment after.
+
 2004-04-19  Andrew PInski  <pinskia@physics.uc.edu>
 
        * builtins.c (fold_builtin_cabs): Remove fndecl parameter.
index d19fc9fdf3fb63a6700f277b8f04969b878e53b4..33d0a86e90d9c78a326444b6fa329f9a30719f72 100644 (file)
@@ -512,10 +512,7 @@ layout_decl (tree decl, unsigned int known_align)
              || TREE_CODE (DECL_SIZE_UNIT (decl)) == INTEGER_CST))
        DECL_ALIGN (decl) = MIN (DECL_ALIGN (decl), BITS_PER_UNIT);
 
-      /* Should this be controlled by DECL_USER_ALIGN, too?  */
-      if (maximum_field_alignment != 0)
-       DECL_ALIGN (decl) = MIN (DECL_ALIGN (decl), maximum_field_alignment);
-      if (! DECL_USER_ALIGN (decl))
+      if (! DECL_USER_ALIGN (decl) && ! DECL_PACKED (decl))
        {
          /* Some targets (i.e. i386, VMS) limit struct field alignment
             to a lower boundary than alignment of variables unless
@@ -528,6 +525,10 @@ layout_decl (tree decl, unsigned int known_align)
          DECL_ALIGN (decl) = ADJUST_FIELD_ALIGN (decl, DECL_ALIGN (decl));
 #endif
        }
+
+      /* Should this be controlled by DECL_USER_ALIGN, too?  */
+      if (maximum_field_alignment != 0)
+       DECL_ALIGN (decl) = MIN (DECL_ALIGN (decl), maximum_field_alignment);
     }
 
   /* Evaluate nonconstant size only once, either now or as soon as safe.  */