aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorMark Mitchell <mark@codesourcery.com>2002-10-21 21:47:44 +0000
committerMark Mitchell <mmitchel@gcc.gnu.org>2002-10-21 21:47:44 +0000
commite3ccdd508a2befa298813b1975141572b462c84f (patch)
tree09026cdbd3a0f95e9efc3ed1fb5b6c8dc5089714 /gcc
parent75d383798962aa309d4474fdb2d8ce17db50a031 (diff)
downloadgcc-e3ccdd508a2befa298813b1975141572b462c84f.zip
gcc-e3ccdd508a2befa298813b1975141572b462c84f.tar.gz
gcc-e3ccdd508a2befa298813b1975141572b462c84f.tar.bz2
class.c (include_empty_classes): Use normalize_rli.
* class.c (include_empty_classes): Use normalize_rli. (layout_class_type): Likewise. From-SVN: r58388
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog3
-rw-r--r--gcc/cp/class.c29
2 files changed, 24 insertions, 8 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 74e5ef3..6fa961f 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,8 @@
2002-10-21 Mark Mitchell <mark@codesourcery.com>
+ * class.c (include_empty_classes): Use normalize_rli.
+ (layout_class_type): Likewise.
+
* decl.c (reshape_init): Tweak handling of character arrays.
PR c++/8218
diff --git a/gcc/cp/class.c b/gcc/cp/class.c
index 1745c0d..4923b00 100644
--- a/gcc/cp/class.c
+++ b/gcc/cp/class.c
@@ -4761,6 +4761,7 @@ static void
include_empty_classes (record_layout_info rli)
{
tree eoc;
+ tree rli_size;
/* It might be the case that we grew the class to allocate a
zero-sized base class. That won't be reflected in RLI, yet,
@@ -4769,11 +4770,20 @@ include_empty_classes (record_layout_info rli)
to reflect the entire class. */
eoc = end_of_class (rli->t,
CLASSTYPE_AS_BASE (rli->t) != NULL_TREE);
- if (TREE_CODE (rli_size_unit_so_far (rli)) == INTEGER_CST
- && INT_CST_LT_UNSIGNED (rli_size_unit_so_far (rli), eoc))
+ rli_size = rli_size_unit_so_far (rli);
+ if (TREE_CODE (rli_size) == INTEGER_CST
+ && INT_CST_LT_UNSIGNED (rli_size, eoc))
{
- rli->offset = size_binop (MAX_EXPR, rli->offset, eoc);
- rli->bitpos = bitsize_zero_node;
+ rli->bitpos = round_up (rli->bitpos, BITS_PER_UNIT);
+ rli->bitpos
+ = size_binop (PLUS_EXPR,
+ rli->bitpos,
+ size_binop (MULT_EXPR,
+ convert (bitsizetype,
+ size_binop (MINUS_EXPR,
+ eoc, rli_size)),
+ bitsize_int (BITS_PER_UNIT)));
+ normalize_rli (rli);
}
}
@@ -4947,10 +4957,13 @@ layout_class_type (tree t, int *vfuns_p, tree *virtuals_p)
}
if (abi_version_at_least (2) && !integer_zerop (rli->bitpos))
- /* Make sure that we are on a byte boundary so that the size of
- the class without virtual bases will always be a round number
- of bytes. */
- rli->bitpos = round_up (rli->bitpos, BITS_PER_UNIT);
+ {
+ /* Make sure that we are on a byte boundary so that the size of
+ the class without virtual bases will always be a round number
+ of bytes. */
+ rli->bitpos = round_up (rli->bitpos, BITS_PER_UNIT);
+ normalize_rli (rli);
+ }
/* Make sure that empty classes are reflected in RLI at this
point. */