From patchwork Fri Mar 9 06:37:31 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: 145672 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 B07D7B6FCC for ; Fri, 9 Mar 2012 17:37:52 +1100 (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=1331879873; 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=p9Sh8e+PU6gi+8jV3gMj5AEGNAQ=; b=R4g2Yig45Ycujtb 25+fHS51xUzQBbDiAtXpbT9XBJM6TnhxEN+Vk6XtrsscF2lw5JCVAQQcwRLd6/Lg fGto2GzGSzqLSkQp+mpKgJY1teQ+mzOwmGxaDs7blHOaySgEKyD6UX2zh0s3cXdT rDbFd0Y3Xp+gA5giWgCJgjjcRBr0= 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=hcDppcmKmxdq1b934pXQFbfCOI349IOQIyUU9WafpuGQhzM7Oma+LJa4VxnHzG Ut1/wkvj77bUT9MULmZZrwQIlSqGS4Syd2A7NPMAjODUWC+wKbsywPNb08/Rn8Hm /YXLssRYQGBVk16touDx9Yo8DNLJL+jnqEuVOPDmq2CEI=; Received: (qmail 15714 invoked by alias); 9 Mar 2012 06:37:48 -0000 Received: (qmail 15574 invoked by uid 22791); 9 Mar 2012 06:37:47 -0000 X-SWARE-Spam-Status: No, hits=-2.6 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_LOW, TW_CC, T_RP_MATCHES_RCVD, T_TVD_MIME_NO_HEADERS X-Spam-Check-By: sourceware.org Received: from mail-tul01m020-f175.google.com (HELO mail-tul01m020-f175.google.com) (209.85.214.175) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 09 Mar 2012 06:37:34 +0000 Received: by obqv19 with SMTP id v19so1869307obq.20 for ; Thu, 08 Mar 2012 22:37:34 -0800 (PST) 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=Xs8QE4s86gK8wIQ49cogr4d/TyEscv0RdVtE+CyC9vY=; b=PiRjaoKT2EilZ9GNlnSrAVO9D8YM3dBRvWeDkgMAR/qYXCGWNj3UD050shQej4w9fb 7fCrGV16tLuws4aJltyckEqrraSg8Xf6XZN4haEOUGcsNgoMen/cKFpOFN+ndk2VM9la YhIl1naKYcYtyAd0oZyZwtc6hZhDtPDFpiuMF2wkOzz2ezv/xiEU5W8eipmMvxhSS93c vS/rP0RqbEJ+23wSrKytOwdEqWyEsTur2Sp1f1U9SxZsCdaC6bqYSXA0ZpFaqCjp8Upm A41DEjQqHA8VhaatBhKJIAs5CMCN2Ely6UA7Im2RSuksBuIYpWIP45ApT4UCsUSJHoTt lSng== Received: by 10.182.141.9 with SMTP id rk9mr424072obb.50.1331275054320; Thu, 08 Mar 2012 22:37:34 -0800 (PST) Received: by 10.182.141.9 with SMTP id rk9mr424062obb.50.1331275054196; Thu, 08 Mar 2012 22:37:34 -0800 (PST) Received: from coign.google.com ([216.239.45.130]) by mx.google.com with ESMTPS id v7sm6101963obh.1.2012.03.08.22.37.32 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 08 Mar 2012 22:37:33 -0800 (PST) From: Ian Lance Taylor To: gcc-patches@gcc.gnu.org, gofrontend-dev@googlegroups.com Subject: Go patch committed: Fix sink receiver Date: Thu, 08 Mar 2012 22:37:31 -0800 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) MIME-Version: 1.0 X-Gm-Message-State: ALoCoQmu5pFIOn/5jZXO69EwIesov9bgCnyv5VEZ2t2LYSN59QfIY2iy8hcuwQReJXfd2p0Qc9WRd35ZdgPtgyyAsbnyWaV0+6MfcXmXl4DGvLoETOgygmoOk2rhw4Y3oy+o04/HTPOLfQNKYH+XbtpH7A9uVhliCECEJqM1P6zNpWh95Kt3frE= 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 a function with a sink receiver, as in func (_ T) F() I've added a test case for this to the master Go testsuite, which will be copied into the gccgo testsuite in due course. Bootstrapped and ran Go testsuite on x86_64-unknown-linux-gnu. Committed to mainline. Ian diff -r f3b4795ea475 go/gogo.cc --- a/go/gogo.cc Thu Mar 08 22:34:11 2012 -0800 +++ b/go/gogo.cc Thu Mar 08 22:35:23 2012 -0800 @@ -628,7 +628,7 @@ Variable* this_param = new Variable(receiver->type(), NULL, false, true, true, location); std::string rname = receiver->name(); - if (rname.empty()) + if (rname.empty() || Gogo::is_sink_name(rname)) { // We need to give receivers a name since they wind up in // DECL_ARGUMENTS. FIXME. @@ -638,8 +638,7 @@ ++count; rname = buf; } - if (!Gogo::is_sink_name(rname)) - block->bindings()->add_variable(rname, NULL, this_param); + block->bindings()->add_variable(rname, NULL, this_param); } const Typed_identifier_list* parameters = type->parameters();