From patchwork Wed Aug 10 15:43:59 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Biener X-Patchwork-Id: 109390 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 5CC11B6F69 for ; Thu, 11 Aug 2011 01:44:19 +1000 (EST) Received: (qmail 27664 invoked by alias); 10 Aug 2011 15:44:16 -0000 Received: (qmail 27651 invoked by uid 22791); 10 Aug 2011 15:44:15 -0000 X-SWARE-Spam-Status: No, hits=-3.7 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD, TW_CP X-Spam-Check-By: sourceware.org Received: from cantor2.suse.de (HELO mx2.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 10 Aug 2011 15:44:01 +0000 Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.221.2]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx2.suse.de (Postfix) with ESMTP id C830F8980B; Wed, 10 Aug 2011 17:43:59 +0200 (CEST) Date: Wed, 10 Aug 2011 17:43:59 +0200 (CEST) From: Richard Guenther To: Jason Merrill Cc: gcc-patches@gcc.gnu.org Subject: Re: [PATCH][C++] Remove last use of can_trust_pointer_alignment In-Reply-To: Message-ID: References: <4E429BBB.4020105@redhat.com> User-Agent: Alpine 2.00 (LNX 1167 2008-08-23) MIME-Version: 1.0 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org On Wed, 10 Aug 2011, Richard Guenther wrote: > On Wed, 10 Aug 2011, Jason Merrill wrote: > > > On 08/10/2011 08:35 AM, Richard Guenther wrote: > > > * call.c (build_over_call): Call memcpy unconditionally. > > > > OK. Have you tested the MEM_REF patch? > > No, not yet. I'll throw it to testing now. The following is what passed bootstrap sofar and is in testing now. Richard. Index: gcc/cp/call.c =================================================================== --- gcc/cp/call.c (revision 177625) +++ gcc/cp/call.c (working copy) @@ -6766,19 +6766,22 @@ build_over_call (struct z_candidate *can } else { - /* We must only copy the non-tail padding parts. - Use __builtin_memcpy for the bitwise copy. */ - tree arg0, arg1, arg2, t; + /* We must only copy the non-tail padding parts. */ + tree arg0, arg2, t; + tree array_type, alias_set; arg2 = TYPE_SIZE_UNIT (as_base); - arg1 = arg; arg0 = cp_build_addr_expr (to, complain); - t = implicit_built_in_decls[BUILT_IN_MEMCPY]; - t = build_call_n (t, 3, arg0, arg1, arg2); - - t = convert (TREE_TYPE (arg0), t); - val = cp_build_indirect_ref (t, RO_NULL, complain); + array_type = build_array_type (char_type_node, + build_index_type + (size_binop (MINUS_EXPR, + arg2, size_int (1)))); + alias_set = build_int_cst (build_pointer_type (type), 0); + t = build2 (MODIFY_EXPR, void_type_node, + build2 (MEM_REF, array_type, arg0, alias_set), + build2 (MEM_REF, array_type, arg, alias_set)); + val = build2 (COMPOUND_EXPR, TREE_TYPE (to), t, to); TREE_NO_WARNING (val) = 1; }