aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authorRichard Henderson <rth@redhat.com>2004-06-30 13:01:29 -0700
committerRichard Henderson <rth@gcc.gnu.org>2004-06-30 13:01:29 -0700
commit1d528e29aabbe60e60e3f19c78def8097ccb9157 (patch)
tree99a87592c9c8006b75f85f591c4bc3f5a84e808f /gcc/cp
parent9117ccad0c195d26cc27f4ccfede367255c2bc03 (diff)
downloadgcc-1d528e29aabbe60e60e3f19c78def8097ccb9157.zip
gcc-1d528e29aabbe60e60e3f19c78def8097ccb9157.tar.gz
gcc-1d528e29aabbe60e60e3f19c78def8097ccb9157.tar.bz2
call.c (build_over_call): Use __builtin_memcpy for copying CLASS_AS_BASE rather than funny casting.
* call.c (build_over_call): Use __builtin_memcpy for copying CLASS_AS_BASE rather than funny casting. From-SVN: r83928
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/ChangeLog5
-rw-r--r--gcc/cp/call.c41
2 files changed, 24 insertions, 22 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 1c138da..b094bac 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,10 @@
2004-06-30 Richard Henderson <rth@redhat.com>
+ * call.c (build_over_call): Use __builtin_memcpy for copying
+ CLASS_AS_BASE rather than funny casting.
+
+2004-06-30 Richard Henderson <rth@redhat.com>
+
* init.c (build_new_1): Fill in TYPE_DOMAIN, TYPE_SIZE and
TYPE_SIZE_UNIT of full_type.
diff --git a/gcc/cp/call.c b/gcc/cp/call.c
index 207d758..99603ea 100644
--- a/gcc/cp/call.c
+++ b/gcc/cp/call.c
@@ -4795,31 +4795,28 @@ build_over_call (struct z_candidate *cand, int flags)
tree type = TREE_TYPE (to);
tree as_base = CLASSTYPE_AS_BASE (type);
- arg = build_indirect_ref (TREE_VALUE (TREE_CHAIN (converted_args)), 0);
+ arg = TREE_VALUE (TREE_CHAIN (converted_args));
if (tree_int_cst_equal (TYPE_SIZE (type), TYPE_SIZE (as_base)))
- val = build (MODIFY_EXPR, TREE_TYPE (to), to, arg);
+ {
+ arg = build_indirect_ref (arg, 0);
+ val = build (MODIFY_EXPR, TREE_TYPE (to), to, arg);
+ }
else
{
- /* We must only copy the non-tail padding parts. Use
- CLASSTYPE_AS_BASE for the bitwise copy. */
- tree to_ptr, arg_ptr, to_as_base, arg_as_base, base_ptr_type;
- tree save_to;
-
- to_ptr = save_expr (build_unary_op (ADDR_EXPR, to, 0));
- arg_ptr = build_unary_op (ADDR_EXPR, arg, 0);
-
- base_ptr_type = build_pointer_type (as_base);
- to_as_base = build_nop (base_ptr_type, to_ptr);
- to_as_base = build_indirect_ref (to_as_base, 0);
- arg_as_base = build_nop (base_ptr_type, arg_ptr);
- arg_as_base = build_indirect_ref (arg_as_base, 0);
-
- save_to = build_indirect_ref (to_ptr, 0);
-
- val = build (MODIFY_EXPR, as_base, to_as_base, arg_as_base);
- val = convert_to_void (val, NULL);
- val = build (COMPOUND_EXPR, type, val, save_to);
- TREE_NO_WARNING (val) = 1;
+ /* We must only copy the non-tail padding parts.
+ Use __builtin_memcpy for the bitwise copy. */
+
+ tree args, t;
+
+ args = tree_cons (NULL, TYPE_SIZE_UNIT (as_base), NULL);
+ args = tree_cons (NULL, arg, args);
+ t = build_unary_op (ADDR_EXPR, to, 0);
+ args = tree_cons (NULL, t, args);
+ t = implicit_built_in_decls[BUILT_IN_MEMCPY];
+ t = build_call (t, args);
+
+ t = convert (TREE_TYPE (TREE_VALUE (args)), t);
+ val = build_indirect_ref (t, 0);
}
return val;