From patchwork Wed Jan 12 18:32:16 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aldy Hernandez X-Patchwork-Id: 78606 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 7C195B6F2B for ; Thu, 13 Jan 2011 05:32:24 +1100 (EST) Received: (qmail 24825 invoked by alias); 12 Jan 2011 18:32:23 -0000 Received: (qmail 24814 invoked by uid 22791); 12 Jan 2011 18:32:23 -0000 X-SWARE-Spam-Status: No, hits=-6.3 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_HI, SPF_HELO_PASS, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 12 Jan 2011 18:32:18 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id p0CIWGKd016220 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 12 Jan 2011 13:32:17 -0500 Received: from vishnu.quesejoda.com (vpn-233-126.phx2.redhat.com [10.3.233.126]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p0CIWGCi007871; Wed, 12 Jan 2011 13:32:16 -0500 Message-ID: <4D2DF3B0.5020609@redhat.com> Date: Wed, 12 Jan 2011 12:32:16 -0600 From: Aldy Hernandez User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.13) Gecko/20101209 Fedora/3.1.7-0.35.b3pre.fc14 Lightning/1.0b3pre Thunderbird/3.1.7 MIME-Version: 1.0 To: Richard Henderson CC: gcc-patches@gcc.gnu.org Subject: Re: [trans-mem] fix transaction_callable's with asm statements References: <4D2CAFEB.2020607@redhat.com> <4D2DEE78.8010506@redhat.com> In-Reply-To: <4D2DEE78.8010506@redhat.com> 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 01/12/11 12:10, Richard Henderson wrote: >> /* Handle the easy initialization to zero. */ >> - if (CONSTRUCTOR_ELTS (rhs) == 0) >> + if (CONSTRUCTOR_ELTS (rhs) == 0&& INTEGRAL_TYPE_P (type)) >> rhs = build_int_cst (type, 0); > While this works, it's not what I intended. In particular, > you'll never see a CONSTRUCTOR for an integral type, so this > condition will never fire. > > What's intended here is to store a zero of the proper size > into the location. So actually the little change is > > rhs = build_int_cst (simple_type, 0); > > This should probably be done as a separate fix, since it > turns out to be non-obvious. Fixed in attached patch and committed. > Ok. You're probably right that the ipa pass needs to be rewritten. > Third time's the charm, right? I hope so :). I've committed this part of the patch independently. Thanks. Now, on to the actual bug I was fixing :). * trans-mem.c (build_tm_store): Build correct type when handling CONSTRUCTORs. Index: trans-mem.c =================================================================== --- trans-mem.c (revision 168726) +++ trans-mem.c (working copy) @@ -2068,7 +2068,7 @@ build_tm_store (location_t loc, tree lhs { /* Handle the easy initialization to zero. */ if (CONSTRUCTOR_ELTS (rhs) == 0) - rhs = build_int_cst (type, 0); + rhs = build_int_cst (simple_type, 0); else { /* ...otherwise punt to the caller and probably use