From 83b14b884703a989f1ac97df97588fddbc979c5a Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Tue, 18 Jun 2002 12:05:31 -0400 Subject: [PATCH] C++ ABI changes. * class.c (build_base_field): Set DECL_PACKED. (layout_class_type): Don't use tail padding of PODs. * mangle.c (write_unqualified_name): Fix template conversion op mangling. From-SVN: r54747 --- gcc/cp/ChangeLog | 8 ++++++++ gcc/cp/class.c | 8 ++++++++ gcc/cp/mangle.c | 11 ++++++++++- 3 files changed, 26 insertions(+), 1 deletion(-) diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 4da4bd4b779d..21ced62e8408 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,11 @@ +2002-06-14 Jason Merrill + + C++ ABI changes. + * class.c (build_base_field): Set DECL_PACKED. + (layout_class_type): Don't use tail padding of PODs. + * mangle.c (write_unqualified_name): Fix template conversion op + mangling. + 2002-06-16 Richard Henderson PR opt/6793 diff --git a/gcc/cp/class.c b/gcc/cp/class.c index 1be2897f2f94..09a03857afee 100644 --- a/gcc/cp/class.c +++ b/gcc/cp/class.c @@ -3837,6 +3837,8 @@ build_base_field (rli, binfo, empty_p, offsets, t) DECL_SIZE_UNIT (decl) = CLASSTYPE_SIZE_UNIT (basetype); DECL_ALIGN (decl) = CLASSTYPE_ALIGN (basetype); DECL_USER_ALIGN (decl) = CLASSTYPE_USER_ALIGN (basetype); + /* Tell the backend not to round up to TYPE_ALIGN. */ + DECL_PACKED (decl) = 1; if (!integer_zerop (DECL_SIZE (decl))) { @@ -4978,6 +4980,12 @@ layout_class_type (t, empty_p, vfuns_p, CLASSTYPE_SIZE (t) = bitsize_zero_node; CLASSTYPE_SIZE_UNIT (t) = size_zero_node; } + /* If this is a POD, we can't reuse its tail padding. */ + else if (!CLASSTYPE_NON_POD_P (t)) + { + CLASSTYPE_SIZE (t) = TYPE_SIZE (t); + CLASSTYPE_SIZE_UNIT (t) = TYPE_SIZE_UNIT (t); + } else { CLASSTYPE_SIZE (t) = TYPE_BINFO_SIZE (t); diff --git a/gcc/cp/mangle.c b/gcc/cp/mangle.c index 12888ace7d8e..996b0272d731 100644 --- a/gcc/cp/mangle.c +++ b/gcc/cp/mangle.c @@ -988,8 +988,17 @@ write_unqualified_name (decl) { /* Conversion operator. Handle it right here. ::= cv */ + tree type; + if (decl_is_template_id (decl, NULL)) + { + tree fn_type = get_mostly_instantiated_function_type (decl, NULL, + NULL); + type = TREE_TYPE (fn_type); + } + else + type = TREE_TYPE (DECL_NAME (decl)); write_string ("cv"); - write_type (TREE_TYPE (DECL_NAME (decl))); + write_type (type); } else if (DECL_OVERLOADED_OPERATOR_P (decl)) {