From 3075b32758eafbf3cb6dadb9225d28bb2b6abfab Mon Sep 17 00:00:00 2001 From: Nathan Sidwell Date: Fri, 12 Dec 2003 14:48:31 +0000 Subject: PR c++/13114, c++/13115 PR c++/13114, c++/13115 * class.c (layout_empty_base): Propagate the move of an empty base to offset zero. From-SVN: r74573 --- gcc/cp/ChangeLog | 4 ++++ gcc/cp/class.c | 18 +++++++++++------- gcc/testsuite/g++.dg/abi/covariant2.C | 2 +- 3 files changed, 16 insertions(+), 8 deletions(-) (limited to 'gcc') diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 0e90958..6b57a91 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,9 @@ 2003-12-12 Nathan Sidwell + PR c++/13114, c++/13115 + * class.c (layout_empty_base): Propagate the move of an empty base + to offset zero. + PR c++/12881 * method.c (make_thunk): Deal with thunk aliases when searching for a thunk. Robustify assertion. diff --git a/gcc/cp/class.c b/gcc/cp/class.c index 72f03a2..bc44452 100644 --- a/gcc/cp/class.c +++ b/gcc/cp/class.c @@ -3576,14 +3576,18 @@ layout_empty_base (tree binfo, tree eoc, splay_tree offsets) /* This routine should only be used for empty classes. */ my_friendly_assert (is_empty_class (basetype), 20000321); alignment = ssize_int (CLASSTYPE_ALIGN_UNIT (basetype)); - - if (abi_version_at_least (2)) - BINFO_OFFSET (binfo) = size_zero_node; - if (warn_abi && !integer_zerop (BINFO_OFFSET (binfo))) - warning ("offset of empty base `%T' may not be ABI-compliant and may" - "change in a future version of GCC", - BINFO_TYPE (binfo)); + if (!integer_zerop (BINFO_OFFSET (binfo))) + { + if (abi_version_at_least (2)) + propagate_binfo_offsets + (binfo, size_diffop (size_zero_node, BINFO_OFFSET (binfo))); + else if (warn_abi) + warning ("offset of empty base `%T' may not be ABI-compliant and may" + "change in a future version of GCC", + BINFO_TYPE (binfo)); + } + /* This is an empty base class. We first try to put it at offset zero. */ if (layout_conflict_p (binfo, diff --git a/gcc/testsuite/g++.dg/abi/covariant2.C b/gcc/testsuite/g++.dg/abi/covariant2.C index 233c55a..87eb2a2 100644 --- a/gcc/testsuite/g++.dg/abi/covariant2.C +++ b/gcc/testsuite/g++.dg/abi/covariant2.C @@ -2,7 +2,7 @@ // Copyright (C) 2003 Free Software Foundation, Inc. // Contributed by Nathan Sidwell 12 Dec 2003 -// Origin: Volker Reichelt +// Origin: grigory@stl.sarov.ru // PR c++/12881. ICE in thunk generation -- cgit v1.1