From patchwork Mon Aug 22 21:30:50 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Lance Taylor X-Patchwork-Id: 661620 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]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3sJ6FV53pGz9sR9 for ; Tue, 23 Aug 2016 07:31:10 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=u5GQwwG2; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:from:date:message-id:subject:to:content-type; q= dns; s=default; b=ux6HvQYjHzo2JM/tF2tn+BmNw9s+RxzGKDQiiU9ikMByqf 4ft1yzcBFiPKwTAGoLTxbl0SqxBdb2U4DrJMrpN1CO4+HumxcVFOpKpFPoWRLnzI ztpscEoEIaSyubjquZADXL86WTFm8pdOOAe9IJ1j30UkwVsv5RsW+T0ONTxoE= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:from:date:message-id:subject:to:content-type; s= default; bh=U+u5VOALC++nH/rNqYDRqtpW+5g=; b=u5GQwwG2ARNLhIo8h0jA FmNd/lwNiUFI7oOMdwFKJITqd9wY5oyhJY21p0v2sY2JyUZIjGMguhDvA34RRP6l UAAwi3D+YFNm2TZPSwFlZDCy5vFRcaGW2euK7HGh0b5AO4nU7pSZ67PcvxiGdlCE SRIDLJykIvkVW5URC1UlhLE= Received: (qmail 122040 invoked by alias); 22 Aug 2016 21:31:03 -0000 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 Received: (qmail 122023 invoked by uid 89); 22 Aug 2016 21:31:02 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.4 required=5.0 tests=AWL, BAYES_05, KAM_ASCII_DIVIDERS, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=no version=3.3.2 spammy=pm, Than, UD:M, p.m X-HELO: mail-it0-f44.google.com Received: from mail-it0-f44.google.com (HELO mail-it0-f44.google.com) (209.85.214.44) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 22 Aug 2016 21:30:52 +0000 Received: by mail-it0-f44.google.com with SMTP id e63so15165068ith.1 for ; Mon, 22 Aug 2016 14:30:52 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=+hXos+FSVB+Xu7cPyZwmmqBrqq1AaFVUJ4QY9jnKq1c=; b=MtRl/XMB/Z2Kh7oTErBA+6LNi6WmwfTRlngA8tBdOriYiaOmptrHHfltcbIx1q+F8r kKl8b3NIif19lf9S5E6HfYxZez76nR57eaSfwEdIzsDHpmDJ5Dz28A94d83Tdj7SQBs/ YCo05sXSbXpcTJc0v4An6k58olse25DAXL3xhhkbdeZyC71f+Kr44+Vns2TpOx1krK6h vamVGfrmNnOu8O2OK8vwW8B4tJfwLsAI7YjmB6PL+y5e77qF1YpUsZsmR5yvZgwKR626 +vepWfFsr0SwbwXtIsnRpHrSJoZAK8dG2FmU9QTD+CgFakY7kqwVQXjOXR2YboquURX/ Fahg== X-Gm-Message-State: AEkoousKd6GXlr7ufZwgS2xvM+t268s3RhGMvO2pZlwn7P83Uoysft6e+QTgceXPlM0xRbFguIkpsINbNSwJrg== X-Received: by 10.36.22.67 with SMTP id a64mr14365158ita.66.1471901451232; Mon, 22 Aug 2016 14:30:51 -0700 (PDT) MIME-Version: 1.0 Received: by 10.79.35.199 with HTTP; Mon, 22 Aug 2016 14:30:50 -0700 (PDT) From: Ian Lance Taylor Date: Mon, 22 Aug 2016 14:30:50 -0700 Message-ID: Subject: Go patch committed: Don't permit P.M for a pointer type To: gcc-patches , "gofrontend-dev@googlegroups.com" https://golang.org/issue/15722 points out that gccgo was incorrectly permitting P.M to used as a method expression when P is a pointer type. This patch by Than McIntosh fixes the problem. Bootstrapped and ran Go testsuite on x86_64-pc-linux-gnu. Committed to mainline. Ian Index: gcc/go/gofrontend/MERGE =================================================================== --- gcc/go/gofrontend/MERGE (revision 239486) +++ gcc/go/gofrontend/MERGE (working copy) @@ -1,4 +1,4 @@ -affb1bf5fcd7abf05993c54313d8000b93a08d4a +0476944600d456b2616981fff90c77be5e06edd5 The first line of this file holds the git revision number of the last merge done from the gofrontend repository. Index: gcc/go/gofrontend/expressions.cc =================================================================== --- gcc/go/gofrontend/expressions.cc (revision 239332) +++ gcc/go/gofrontend/expressions.cc (working copy) @@ -11439,7 +11439,8 @@ Expression* Selector_expression::lower_method_expression(Gogo* gogo) { Location location = this->location(); - Type* type = this->left_->type(); + Type* left_type = this->left_->type(); + Type* type = left_type; const std::string& name(this->name_); bool is_pointer; @@ -11469,7 +11470,8 @@ Selector_expression::lower_method_expres imethod = it->find_method(name); } - if (method == NULL && imethod == NULL) + if ((method == NULL && imethod == NULL) + || (left_type->named_type() != NULL && left_type->points_to() != NULL)) { if (!is_ambiguous) error_at(location, "type %<%s%s%> has no method %<%s%>",