aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJason Merrill <jason@yorick.cygnus.com>1998-04-07 03:48:22 +0000
committerJason Merrill <jason@gcc.gnu.org>1998-04-06 23:48:22 -0400
commita59ca936781f83a822e57f0a4ad4d6b8052139e0 (patch)
treee8b7595994582cee45b6c20eb9d3bc039af6ff5d /gcc
parentcd36edbdfbddced4fe8d976a9c4fc3fdb744832e (diff)
downloadgcc-a59ca936781f83a822e57f0a4ad4d6b8052139e0.zip
gcc-a59ca936781f83a822e57f0a4ad4d6b8052139e0.tar.gz
gcc-a59ca936781f83a822e57f0a4ad4d6b8052139e0.tar.bz2
call.c (build_call): Still evaluate the actual argument.
* call.c (build_call): Still evaluate the actual argument. * class.c (is_empty_class): Update for -fnew-abi. * decl2.c: -fnew-abi implies -fsquangle. * method.c (do_build_assign_ref): Don't do anything to copy an empty class. (do_build_copy_constructor): Likewise. * call.c (build_over_call): Likewise. From-SVN: r19029
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog12
-rw-r--r--gcc/cp/call.c17
-rw-r--r--gcc/cp/class.c8
-rw-r--r--gcc/cp/decl2.c17
-rw-r--r--gcc/cp/method.c12
5 files changed, 58 insertions, 8 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 5da11fb..02b3f69 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,15 @@
+Mon Apr 6 02:25:05 1998 Jason Merrill <jason@yorick.cygnus.com>
+
+ * call.c (build_call): Still evaluate the actual argument.
+ * class.c (is_empty_class): Update for -fnew-abi.
+
+ * decl2.c: -fnew-abi implies -fsquangle.
+
+ * method.c (do_build_assign_ref): Don't do anything to copy
+ an empty class.
+ (do_build_copy_constructor): Likewise.
+ * call.c (build_over_call): Likewise.
+
Sat Apr 4 18:43:58 1998 Jason Merrill <jason@yorick.cygnus.com>
* tree.c (avoid_overlap): Return a value.
diff --git a/gcc/cp/call.c b/gcc/cp/call.c
index 192640c..d001331 100644
--- a/gcc/cp/call.c
+++ b/gcc/cp/call.c
@@ -525,7 +525,8 @@ build_call (function, result_type, parms)
TREE_TYPE (t) = TREE_TYPE (TREE_VALUE (tmp));
RTL_EXPR_RTL (t) = const0_rtx;
RTL_EXPR_SEQUENCE (t) = NULL_RTX;
- TREE_VALUE (tmp) = t;
+ TREE_VALUE (tmp) = build (COMPOUND_EXPR, TREE_TYPE (t),
+ TREE_VALUE (tmp), t);
}
function = build_nt (CALL_EXPR, function, parms, NULL_TREE);
@@ -3351,6 +3352,12 @@ build_over_call (fn, convs, args, flags)
{
tree to = stabilize_reference
(build_indirect_ref (TREE_VALUE (args), 0));
+
+ /* Don't copy the padding byte; it might not have been allocated
+ if to is a base subobject. */
+ if (is_empty_class (DECL_CLASS_CONTEXT (fn)))
+ return to;
+
val = build (INIT_EXPR, DECL_CONTEXT (fn), to, arg);
TREE_SIDE_EFFECTS (val) = 1;
return build_unary_op (ADDR_EXPR, val, 0);
@@ -3358,10 +3365,16 @@ build_over_call (fn, convs, args, flags)
}
else if (DECL_NAME (fn) == ansi_opname[MODIFY_EXPR]
&& copy_args_p (fn)
- && TYPE_HAS_TRIVIAL_ASSIGN_REF (DECL_CONTEXT (fn)))
+ && TYPE_HAS_TRIVIAL_ASSIGN_REF (DECL_CLASS_CONTEXT (fn)))
{
tree to = stabilize_reference
(build_indirect_ref (TREE_VALUE (converted_args), 0));
+
+ /* Don't copy the padding byte; it might not have been allocated
+ if to is a base subobject. */
+ if (is_empty_class (DECL_CLASS_CONTEXT (fn)))
+ return to;
+
arg = build_indirect_ref (TREE_VALUE (TREE_CHAIN (converted_args)), 0);
val = build (MODIFY_EXPR, TREE_TYPE (to), to, arg);
TREE_SIDE_EFFECTS (val) = 1;
diff --git a/gcc/cp/class.c b/gcc/cp/class.c
index dc4cc31..c2d6b05 100644
--- a/gcc/cp/class.c
+++ b/gcc/cp/class.c
@@ -5486,7 +5486,13 @@ is_empty_class (type)
{
tree t;
- if (! IS_AGGR_TYPE (type) || TYPE_BINFO_BASETYPES (type))
+ if (! IS_AGGR_TYPE (type))
+ return 0;
+
+ if (flag_new_abi)
+ return CLASSTYPE_SIZE (type) == integer_zero_node;
+
+ if (TYPE_BINFO_BASETYPES (type))
return 0;
t = TYPE_FIELDS (type);
while (t && TREE_CODE (t) != FIELD_DECL)
diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c
index cf9b076..42cbba9 100644
--- a/gcc/cp/decl2.c
+++ b/gcc/cp/decl2.c
@@ -401,7 +401,9 @@ int flag_new_for_scope = 1;
int flag_weak = 1;
-int flag_new_abi = 1;
+/* Nonzero to enable experimental ABI changes. */
+
+int flag_new_abi;
/* Maximum template instantiation depth. Must be at least 17 for ANSI
compliance. */
@@ -469,8 +471,7 @@ static struct { char *string; int *variable; int on_value;} lang_f_options[] =
{"check-new", &flag_check_new, 1},
{"repo", &flag_use_repository, 1},
{"for-scope", &flag_new_for_scope, 2},
- {"weak", &flag_weak, 1},
- {"new-abi", &flag_new_abi, 1}
+ {"weak", &flag_weak, 1}
};
/* Decode the string P as a language-specific option.
@@ -562,6 +563,16 @@ lang_decode_option (p)
error ("-fno-ansi-overloading is no longer supported");
found = 1;
}
+ else if (!strcmp (p, "new-abi"))
+ {
+ flag_new_abi = 1;
+ flag_do_squangling = 1;
+ }
+ else if (!strcmp (p, "no-new-abi"))
+ {
+ flag_new_abi = 0;
+ flag_do_squangling = 0;
+ }
else if (!strncmp (p, "template-depth-", 15))
{
char *endp = p + 15;
diff --git a/gcc/cp/method.c b/gcc/cp/method.c
index 287ce2c..e8ed718 100644
--- a/gcc/cp/method.c
+++ b/gcc/cp/method.c
@@ -2047,7 +2047,11 @@ do_build_copy_constructor (fndecl)
parm = TREE_CHAIN (parm);
parm = convert_from_reference (parm);
- if (TYPE_HAS_TRIVIAL_INIT_REF (current_class_type))
+ if (TYPE_HAS_TRIVIAL_INIT_REF (current_class_type)
+ && is_empty_class (current_class_type))
+ /* Don't copy the padding byte; it might not have been allocated
+ if *this is a base subobject. */;
+ else if (TYPE_HAS_TRIVIAL_INIT_REF (current_class_type))
{
t = build (INIT_EXPR, void_type_node, current_class_ref, parm);
TREE_SIDE_EFFECTS (t) = 1;
@@ -2159,7 +2163,11 @@ do_build_assign_ref (fndecl)
parm = convert_from_reference (parm);
- if (TYPE_HAS_TRIVIAL_ASSIGN_REF (current_class_type))
+ if (TYPE_HAS_TRIVIAL_ASSIGN_REF (current_class_type)
+ && is_empty_class (current_class_type))
+ /* Don't copy the padding byte; it might not have been allocated
+ if *this is a base subobject. */;
+ else if (TYPE_HAS_TRIVIAL_ASSIGN_REF (current_class_type))
{
tree t = build (MODIFY_EXPR, void_type_node, current_class_ref, parm);
TREE_SIDE_EFFECTS (t) = 1;