aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorNathan Sidwell <nathan@codesourcery.com>2003-12-12 14:48:31 +0000
committerNathan Sidwell <nathan@gcc.gnu.org>2003-12-12 14:48:31 +0000
commit3075b32758eafbf3cb6dadb9225d28bb2b6abfab (patch)
tree873f492ce2abcc2b7a5dd9aa0caaad6cdcccb74b /gcc
parent77fec971c15551081d6eccb41275dd1c4e10e73c (diff)
downloadgcc-3075b32758eafbf3cb6dadb9225d28bb2b6abfab.zip
gcc-3075b32758eafbf3cb6dadb9225d28bb2b6abfab.tar.gz
gcc-3075b32758eafbf3cb6dadb9225d28bb2b6abfab.tar.bz2
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
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog4
-rw-r--r--gcc/cp/class.c18
-rw-r--r--gcc/testsuite/g++.dg/abi/covariant2.C2
3 files changed, 16 insertions, 8 deletions
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 <nathan@codesourcery.com>
+ 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 <nathan@codesourcery.com>
-// Origin: Volker Reichelt <reichelt@igpm.rwth-aachen.de>
+// Origin: grigory@stl.sarov.ru
// PR c++/12881. ICE in thunk generation