diff options
author | ktietz <ktietz@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-02-20 22:05:08 +0000 |
---|---|---|
committer | ktietz <ktietz@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-02-20 22:05:08 +0000 |
commit | b527cbf0ec3b752fcf15cc17cf926034d3395398 (patch) | |
tree | 76fcb1843cfb01eb15783e1bd2edaeb026e72dcf /gcc/stor-layout.c | |
parent | 52cec8433482a51db515990c9ae491ff66bd6111 (diff) | |
download | gcc-b527cbf0ec3b752fcf15cc17cf926034d3395398.tar.gz |
PR target/52238
* stor-layout.c (place_field): Handle desired_align for
ms-bitfields, too.
* gcc.dg/bf-ms-layout-3.c: New testcase.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@184409 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/stor-layout.c')
-rw-r--r-- | gcc/stor-layout.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/gcc/stor-layout.c b/gcc/stor-layout.c index 35320c2fad9..a1ac0008c75 100644 --- a/gcc/stor-layout.c +++ b/gcc/stor-layout.c @@ -1141,15 +1141,14 @@ place_field (record_layout_info rli, tree field) } /* 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 @@ place_field (record_layout_info rli, tree field) 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 |