Commit 703790ea authored by mmitchel's avatar mmitchel
Browse files

PR c++/12053

	* class.c (include_empty_classes): Correct logic for ABI version 1.

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


git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@71036 138bc75d-0d04-0410-961f-82ee72b054a4
parent c402c664
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
......
......@@ -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,
......
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
......
// { 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;
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment