This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug target/52238] -mms-bitfields: __attribute__ ((aligned (n))) ignored for struct members
- From: "ktietz at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 16 Feb 2012 14:03:29 +0000
- Subject: [Bug target/52238] -mms-bitfields: __attribute__ ((aligned (n))) ignored for struct members
- Auto-submitted: auto-generated
- References: <bug-52238-4@http.gcc.gnu.org/bugzilla/>
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