aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authorNathan Sidwell <nathan@acm.org>2020-07-28 08:49:13 -0700
committerNathan Sidwell <nathan@acm.org>2020-07-28 09:01:31 -0700
commit0cd58a9f091b39c5e41b7954d6c4bd88f3567d49 (patch)
treec4e176cb7a9150a9bdc489f871bfa6569d34d8ee /gcc/cp
parent9b837af463dc81f849fe99a0ad4f3b477d87c1e3 (diff)
downloadgcc-0cd58a9f091b39c5e41b7954d6c4bd88f3567d49.zip
gcc-0cd58a9f091b39c5e41b7954d6c4bd88f3567d49.tar.gz
gcc-0cd58a9f091b39c5e41b7954d6c4bd88f3567d49.tar.bz2
c++: better fixup_type_variants
fixup_type_variants was almost doing all that finish_struct needs. May as well make it do it all. gcc/cp/ * class.c (fixup_type_variants): Copy TYPE_SIZE and TYPE_SIZE_UINIT. (finish_struct): Call it.
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/class.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/gcc/cp/class.c b/gcc/cp/class.c
index ba96113..7a25d8f 100644
--- a/gcc/cp/class.c
+++ b/gcc/cp/class.c
@@ -1967,6 +1967,9 @@ fixup_type_variants (tree t)
/* Copy whatever these are holding today. */
TYPE_VFIELD (variants) = TYPE_VFIELD (t);
TYPE_FIELDS (variants) = TYPE_FIELDS (t);
+
+ TYPE_SIZE (variants) = TYPE_SIZE (t);
+ TYPE_SIZE_UNIT (variants) = TYPE_SIZE_UNIT (t);
}
}
@@ -7610,12 +7613,7 @@ finish_struct (tree t, tree attributes)
CLASSTYPE_NON_AGGREGATE (t) = 1;
/* Fix up any variants we've already built. */
- for (x = TYPE_NEXT_VARIANT (t); x; x = TYPE_NEXT_VARIANT (x))
- {
- TYPE_SIZE (x) = TYPE_SIZE (t);
- TYPE_SIZE_UNIT (x) = TYPE_SIZE_UNIT (t);
- TYPE_FIELDS (x) = TYPE_FIELDS (t);
- }
+ fixup_type_variants (t);
}
else
finish_struct_1 (t);