+2002-11-24 Mark Mitchell <mark@codesourcery.com>
+
+ * class.c (layout_class_type): Reuse tail padding when laying out
+ virtual bases.
+
2002-11-22 Mark Mitchell <mark@codesourcery.com>
* rtti.c (qualifier_flags): Fix thinko.
normalize_rli (rli);
}
- /* Make sure that empty classes are reflected in RLI at this
- point. */
- include_empty_classes(rli);
+ /* G++ 3.2 does not allow virtual bases to be overlaid with tail
+ padding. */
+ if (!abi_version_at_least (2))
+ include_empty_classes(rli);
/* Delete all zero-width bit-fields from the list of fields. Now
that the type is laid out they are no longer important. */
}
else
{
- TYPE_SIZE (base_t) = rli_size_so_far (rli);
- TYPE_SIZE_UNIT (base_t) = rli_size_unit_so_far (rli);
+ TYPE_SIZE_UNIT (base_t)
+ = size_binop (MAX_EXPR,
+ rli_size_unit_so_far (rli),
+ end_of_class (t, /*include_virtuals_p=*/0));
+ TYPE_SIZE (base_t)
+ = size_binop (MAX_EXPR,
+ rli_size_so_far (rli),
+ size_binop (MULT_EXPR,
+ convert (bitsizetype,
+ TYPE_SIZE_UNIT (base_t)),
+ bitsize_int (BITS_PER_UNIT)));
}
TYPE_ALIGN (base_t) = rli->record_align;
TYPE_USER_ALIGN (base_t) = TYPE_USER_ALIGN (t);
+2002-11-24 Mark Mitchell <mark@codesourcery.com>
+
+ * g++.dg/abi/empty10.C: New test.
+
2002-11-24 Eric Botcazou <ebotcazou@libertysurf.fr>
* gcc.c-torture/compile/20021124-1.c: New test.
--- /dev/null
+// { dg-do run }
+// { dg-options "-fabi-version=0 -w" }
+
+struct E {};
+struct E2 : public E {};
+
+struct A {
+ int i;
+};
+
+struct B {
+ int j;
+};
+
+struct C :
+ public E,
+ public A,
+ public E2,
+ virtual public B {
+};
+
+C c;
+
+int main () {
+ if (((char*)(B*)&c - (char*)&c) != 8)
+ return 1;
+}