re PR c++/12053 (ABI difference between default g++ 3.3 and g++ 3.2)

PR c++/12053
	* class.c (include_empty_classes): Correct logic for ABI version 1.

	PR c++/12053
	* g++.dg/abi/layout4.C: New test.

From-SVN: r71036
This commit is contained in:
Mark Mitchell 2003-09-03 22:00:42 +00:00 committed by Mark Mitchell
parent 47fe5c480b
commit 43fe31f6f9
4 changed files with 41 additions and 1 deletions

View File

@ -1,3 +1,8 @@
2003-09-03 Mark Mitchell <mark@codesourcery.com>
PR c++/12053
* class.c (include_empty_classes): Correct logic for ABI version 1.
2003-09-03 Richard Henderson <rth@redhat.com>
* optimize.c (optimize_function): Push/pop ggc context around

View File

@ -4586,7 +4586,19 @@ include_empty_classes (record_layout_info rli)
if (TREE_CODE (rli_size) == INTEGER_CST
&& INT_CST_LT_UNSIGNED (rli_size, eoc))
{
rli->bitpos = round_up (rli->bitpos, BITS_PER_UNIT);
if (!abi_version_at_least (2))
/* In version 1 of the ABI, the size of a class that ends with
a bitfield was not rounded up to a whole multiple of a
byte. Because rli_size_unit_so_far returns only the number
of fully allocated bytes, any extra bits were not included
in the size. */
rli->bitpos = round_down (rli->bitpos, BITS_PER_UNIT);
else
/* The size should have been rounded to a whole byte. */
my_friendly_assert (tree_int_cst_equal (rli->bitpos,
round_down (rli->bitpos,
BITS_PER_UNIT)),
20030903);
rli->bitpos
= size_binop (PLUS_EXPR,
rli->bitpos,

View File

@ -1,3 +1,8 @@
2003-09-03 Mark Mitchell <mark@codesourcery.com>
PR c++/12053
* g++.dg/abi/layout4.C: New test.
2003-09-02 Scott Brumbaugh <scottb.lists@verizon.net>
PR c++/11553

View File

@ -0,0 +1,18 @@
// { dg-do run { target i?86-*-* } }
// { dg-options "-fabi-version=1" }
struct C4
{
int b:30;
C4(){};
};
struct C1: virtual C4
{
int i;
};
int main() {
if (sizeof (C1) != 12)
return 1;
}