From patchwork Thu Sep 20 04:35:16 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Lance Taylor X-Patchwork-Id: 185307 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 AD1432C009A for ; Thu, 20 Sep 2012 14:36:03 +1000 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1348720565; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Received:Received:From:To:Subject:Date:Message-ID:User-Agent: MIME-Version:Content-Type:Mailing-List:Precedence:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:Sender: Delivered-To; bh=r5gYCNhyfPF8Snb/al/g8N00s2w=; b=ZAAse+zhvFxyhs6 aLud8sr7F/BmGC+sN3yPwk8+KAygcvw56l3GYCp6ftlMyjlVyKb+nToK7ySmkff1 XS1fY9bONjMMvYxQe18SQQD6s5Jr/chbbmnnT4g8nw+teqeSvGhTL2vPHxJi9fMb +FrJ6XhmTuLOOw98jYW8QWzy2l8U= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:X-Google-DKIM-Signature:Received:Received:Received:From:To:Subject:Date:Message-ID:User-Agent:MIME-Version:Content-Type:X-Gm-Message-State:X-IsSubscribed:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=LovHk6257Fvp9zahaHNVoX8v6G+godWCCOCHyQNoM7UhcJg4oIx+NnJNbxjaXW vRD9Fd5NixVWNOPH+6ws2HfgUBUc/FfyG/UuIhmKnV0GC4A0xlZFSCxi4nfSjczA Wd273MAEY1jb9NHjNQ3BZsv7o1HXmi8o0eYUwWSAug1E8=; Received: (qmail 22092 invoked by alias); 20 Sep 2012 04:36:00 -0000 Received: (qmail 21910 invoked by uid 22791); 20 Sep 2012 04:35:58 -0000 X-SWARE-Spam-Status: No, hits=-5.4 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, KHOP_RCVD_TRUST, RCVD_IN_DNSWL_LOW, RCVD_IN_HOSTKARMA_YE, RP_MATCHES_RCVD, T_TVD_MIME_NO_HEADERS X-Spam-Check-By: sourceware.org Received: from mail-pb0-f47.google.com (HELO mail-pb0-f47.google.com) (209.85.160.47) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 20 Sep 2012 04:35:19 +0000 Received: by pbcwy7 with SMTP id wy7so4448228pbc.20 for ; Wed, 19 Sep 2012 21:35:19 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:subject:date:message-id:user-agent:mime-version :content-type:x-gm-message-state; bh=aEehcaQqH5XxOOGW/LkDYaMrdrNP0GMr0Cz5ZI1oVlY=; b=lEvcIfKvw3OPADN1d9AH1yAWMnwZCwg9Cw8rnp53et6FozvX6KDLObisX2Jw18QH4U iCBERKy8obkncDLhQgWKokjL3jIxU8OSIFEE342o8k/9nTIszHr+w8mg4DwlLT2iFlHj 62KSTXAjkHb2A0zPru9JbRk7d2pun7AuBBzddMiYi5J9XUq9eCvjdzT2JSnX3dSU21Xm iSjCaAc6Rn+SXfVn9S7vj6QI5kAtRwLPGAhH5GsRFkre3TSEEPLNMrh6fKJpsib4UhkX 9aJn5jZIOS9EfFakX7Nho5WeMnQGMhlcn5/U2gzSy6Q9Fpw3FiFwyw+pyFfiHkoLccqD IyAg== Received: by 10.68.200.231 with SMTP id jv7mr3295567pbc.140.1348115718879; Wed, 19 Sep 2012 21:35:18 -0700 (PDT) Received: by 10.68.200.231 with SMTP id jv7mr3295560pbc.140.1348115718782; Wed, 19 Sep 2012 21:35:18 -0700 (PDT) Received: from coign.google.com ([172.19.252.231]) by mx.google.com with ESMTPS id bp7sm1812340pab.33.2012.09.19.21.35.17 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 19 Sep 2012 21:35:18 -0700 (PDT) From: Ian Lance Taylor To: gcc-patches@gcc.gnu.org, gofrontend-dev@googlegroups.com Subject: Go patch committed: Fix struct hash/equality with _ fields Date: Wed, 19 Sep 2012 21:35:16 -0700 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) MIME-Version: 1.0 X-Gm-Message-State: ALoCoQkuj/7fR2qRnp40aUwQuWeOEEu52wpxj1n+qczdLP2NqKD0pBdp+/jT6HulUZEkK8EDCb+gFHW02CPqSMw4YRn/QkpRtWN/lczgiTaYN1al5XMNryUwc8ldGZbcx786ZCEWvyn7cZT7E4YVVB3wDm7me3kgklwcOfKRKDjwJ0yV/BQFYdi8cothcFDEjAkEj8Ku9DLP X-IsSubscribed: yes 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 This patch to the Go frontend fixes the handling of struct hash and equality when the struct has _ fields. Those fields should not participate in the hash and equality functions at all. Bootstrapped and ran Go testsuite on x86_64-unknown-linux-gnu. Committed to mainline. Will commit to 4.7 branch when it reopens. Ian diff -r 3408484e8448 go/expressions.cc --- a/go/expressions.cc Wed Sep 19 17:53:19 2012 -0700 +++ b/go/expressions.cc Wed Sep 19 21:32:53 2012 -0700 @@ -5178,6 +5178,9 @@ pf != fields->end(); ++pf, ++field_index) { + if (Gogo::is_sink_name(pf->field_name())) + continue; + if (field_index > 0) { if (left_temp == NULL) diff -r 3408484e8448 go/types.cc --- a/go/types.cc Wed Sep 19 17:53:19 2012 -0700 +++ b/go/types.cc Wed Sep 19 21:32:53 2012 -0700 @@ -579,6 +579,9 @@ p != fields->end(); ++p) { + if (Gogo::is_sink_name(p->field_name())) + continue; + if (!p->type()->is_comparable()) { if (reason != NULL) @@ -4294,6 +4297,9 @@ pf != fields->end(); ++pf) { + if (Gogo::is_sink_name(pf->field_name())) + return false; + if (!pf->type()->compare_is_identity(gogo)) return false; @@ -4767,6 +4773,9 @@ pf != fields->end(); ++pf) { + if (Gogo::is_sink_name(pf->field_name())) + continue; + if (first) first = false; else @@ -4858,6 +4867,9 @@ pf != fields->end(); ++pf, ++field_index) { + if (Gogo::is_sink_name(pf->field_name())) + continue; + // Compare one field in both P1 and P2. Expression* f1 = Expression::make_temporary_reference(p1, bloc); f1 = Expression::make_unary(OPERATOR_MULT, f1, bloc);