From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 51666 invoked by alias); 19 Feb 2016 19:11:14 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 51622 invoked by uid 89); 19 Feb 2016 19:11:13 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Fri, 19 Feb 2016 19:11:12 +0000 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (Postfix) with ESMTPS id 7742D7EBAA; Fri, 19 Feb 2016 19:11:11 +0000 (UTC) Received: from [10.10.116.30] (ovpn-116-30.rdu2.redhat.com [10.10.116.30]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u1JJB9fM000378; Fri, 19 Feb 2016 14:11:10 -0500 Subject: Re: [PATCH] Fix expansion of TREE_ADDRESSABLE bitwise copies (PR c++/69851) To: Jakub Jelinek References: <20160219140330.GJ3017@tucnak.redhat.com> <56C75F5C.6010307@redhat.com> <20160219184122.GV3017@tucnak.redhat.com> <56C76637.60802@redhat.com> <20160219190738.GY3017@tucnak.redhat.com> Cc: Bernd Schmidt , Eric Botcazou , gcc-patches@gcc.gnu.org From: Jason Merrill Message-ID: <56C768CD.5070100@redhat.com> Date: Fri, 19 Feb 2016 19:11:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.0 MIME-Version: 1.0 In-Reply-To: <20160219190738.GY3017@tucnak.redhat.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-SW-Source: 2016-02/txt/msg01371.txt.bz2 On 02/19/2016 02:07 PM, Jakub Jelinek wrote: > On Fri, Feb 19, 2016 at 02:00:07PM -0500, Jason Merrill wrote: >> On 02/19/2016 01:41 PM, Jakub Jelinek wrote: >>> On Fri, Feb 19, 2016 at 01:30:52PM -0500, Jason Merrill wrote: >>>> On 02/19/2016 09:03 AM, Jakub Jelinek wrote: >>>>> As described in the PR, in C++ we can have assignments >>>>> where both the lhs and rhs are COMPONENT_REFs with TREE_ADDRESSABLE types, >>>>> including padding, but the FIELD_DECLs are artificial fields that have >>>>> narrower bit sizes. >>>>> store_field in this case takes the path of bit-field handling (even when >>>>> it has bitpos and bitsize multiples of BITS_PER_UNIT (I think that is >>>>> necessarily true for the TREE_ADDRESSABLE types), which is incorrect, >>>>> because the rhs is expanded in that case through expand_normal, which >>>>> for a result type wider than the FIELD_DECL with forces it into a temporary. >>>>> In older GCCs that just generated inefficient code (copy the rhs into a >>>>> stack temporary, then copy that to lhs), but GCC trunk ICEs on that. >>>>> Fixed by not taking the bit-field path in that case after verifying >>>>> we'll be able to expand it properly using the normal store_expr. >>>> >>>> Won't store_expr clobber tail padding because it doesn't know about bitsize? >>> >>> It doesn't clobber it, because it uses get_inner_reference, expands the >>> inner reference (which is necessarily for something TREE_ADDRESSABLE either >>> a MEM_REF or some decl that lives in memory), and get_inner_reference in >>> that case gives it the bitsize/bitpos from the FIELD_DECL. >>> Which is why in the patch I've posted there is the comparison of DECL_SIZE >>> of the FIELD_DECL against the bitsize that is passed to store_field. >> >> Ah, that makes sense. Please mention that in your added comment. >> >> For GCC 7, can we drop the TREE_ADDRESSABLE check? > > I think we can't drop it, but we could replace it with a check that > get_inner_reference is something that must live in memory > (MEM_REF/TARGET_MEM_REF of SSA_NAME, or of decl that lives in memory, > or decl itself that lives in memory). Please mention that in the comment, as well. OK with those comment changes. Jason