* stor-layout.c (do_type_align): New fn, split out from...
(layout_decl): ...here. Do all alignment calculations for
FIELD_DECLs here.
(update_alignment_for_field): Not here.
(start_record_layout, debug_rli): Remove unpadded_align.
* tree.h (struct record_layout_info_s): Remove unpadded_align.
* c-decl.c (finish_enum): Don't set DECL_SIZE, DECL_ALIGN
or DECL_MODE on the CONST_DECLs.
(finish_struct): Don't mess with DECL_ALIGN.
From-SVN: r72485
--- /dev/null
+// PR c/11885
+// Bug: flag4 was allocated into the same byte as the other flags.
+// { dg-do run }
+
+typedef unsigned char uint8_t;
+
+typedef struct {
+
+ uint8_t flag1:2;
+ uint8_t flag2:1;
+ uint8_t flag3:1;
+
+ uint8_t flag4;
+
+} __attribute__ ((packed)) MyType;
+
+int main (void)
+{
+ MyType a;
+ MyType *b = &a;
+
+ b->flag1 = 0;
+ b->flag2 = 0;
+ b->flag3 = 0;
+
+ b->flag4 = 0;
+
+ b->flag4++;
+
+ if (b->flag1 != 0)
+ abort ();
+}