This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug target/52238] -mms-bitfields: __attribute__ ((aligned (n))) ignored for struct members


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52238

--- Comment #4 from Kai Tietz <ktietz at gcc dot gnu.org> 2012-02-16 14:03:29 UTC ---
Hmm, right.  The previous field needs to be cleared for ms-bitfields, too.

Index: stor-layout.c
===================================================================
--- stor-layout.c       (revision 184287)
+++ stor-layout.c       (working copy)
@@ -1141,15 +1141,14 @@
     }

   /* Does this field automatically have alignment it needs by virtue
-     of the fields that precede it and the record's own alignment?
-     We already align ms_struct fields, so don't re-align them.  */
-  if (known_align < desired_align
-      && !targetm.ms_bitfield_layout_p (rli->t))
+     of the fields that precede it and the record's own alignment?  */
+  if (known_align < desired_align)
     {
       /* No, we need to skip space before this field.
         Bump the cumulative size to multiple of field alignment.  */

-      if (DECL_SOURCE_LOCATION (field) != BUILTINS_LOCATION)
+      if (!targetm.ms_bitfield_layout_p (rli->t)
+          && DECL_SOURCE_LOCATION (field) != BUILTINS_LOCATION)
        warning (OPT_Wpadded, "padding struct to align %q+D", field);

       /* If the alignment is still within offset_align, just align
@@ -1171,7 +1170,8 @@

       if (! TREE_CONSTANT (rli->offset))
        rli->offset_align = desired_align;
-
+      if (targetm.ms_bitfield_layout_p (rli->t))
+        rli->prev_field = NULL;
     }

   /* Handle compatibility with PCC.  Note that if the record has any


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]