* stor-layout.c (update_alignment_for_field): Use
ADJUST_FIELD_ALIGN when computing the alignment for a zero-width
bitfield when PCC_BITFIELD_TYPE_MATTERS.
From-SVN: r60419
+2002-12-22 Mark Mitchell <mark@codesourcery.com>
+
+ * stor-layout.c (update_alignment_for_field): Use
+ ADJUST_FIELD_ALIGN when computing the alignment for a zero-width
+ bitfield when PCC_BITFIELD_TYPE_MATTERS.
+
2002-12-22 Kazu Hirata <kazu@cs.umass.edu>
* genautomata.c: Fix comment typos.
if (! integer_zerop (DECL_SIZE (field)))
rli->record_align = MAX (rli->record_align, desired_align);
else if (! DECL_PACKED (field))
- desired_align = TYPE_ALIGN (type);
+ {
+ desired_align = TYPE_ALIGN (type);
+ desired_align = ADJUST_FIELD_ALIGN (field, desired_align);
+ }
/* A named bit field of declared type `int'
forces the entire structure to have `int' alignment. */
--- /dev/null
+// Test for bitfield alignment in structs on IA-32
+// { dg-do run { target i?86-*-* } }
+// { dg-options "-O2" }
+// { dg-options "-mno-align-double -mno-ms-bitfields" { target *-*-interix* } }
+
+extern void abort (void);
+extern void exit (int);
+
+struct X {
+ char a;
+ long long : 0;
+ char b;
+} x;
+
+int main () {
+ if (&x.b - &x.a != 4)
+ abort ();
+ if (sizeof (x) != 5)
+ abort ();
+
+ exit (0);
+}