From patchwork Tue Jan 6 02:27:04 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Lance Taylor X-Patchwork-Id: 425473 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 F1F44140082 for ; Tue, 6 Jan 2015 13:27:17 +1100 (AEDT) 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:date:message-id:subject:from:to:content-type; q= dns; s=default; b=rU9kkj7Lu+AbEZoNAoQcJi0mYMVGYmv1c/gSZvXPTvb+yL 3m03h2bNCmLf9CI4N7z1Qp37qLSMg6tvxW47xL8uIO5//N68wvUpmTVUd3BMSYtA R0hQsIs2mDphM8xu4P+ElQ14rE/01VQnuZ4ttgDym5OqnezQ9cMYBCv0JB+ms= 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:date:message-id:subject:from:to:content-type; s= default; bh=45GvA4cOT0g2wWvWQpxncQA3Ujs=; b=flbLCcfh0AHruHDd50SP K6a8M80aOcIr2jpuCvovWpPubM6zgummxifx+knMCQA0piY+IjC932k0qtN2RFu6 4dohtvMC/FSTxbHKsuRHUHRYCXXBW8sq+ADEffwdbOJH/Z4eeFbvCYKR/XSHt8za WFiwLAJnMpf4NLjNBtC5jNQ= Received: (qmail 27527 invoked by alias); 6 Jan 2015 02:27:09 -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 27509 invoked by uid 89); 6 Jan 2015 02:27:07 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.5 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-yk0-f175.google.com Received: from mail-yk0-f175.google.com (HELO mail-yk0-f175.google.com) (209.85.160.175) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Tue, 06 Jan 2015 02:27:06 +0000 Received: by mail-yk0-f175.google.com with SMTP id 200so10857054ykr.6 for ; Mon, 05 Jan 2015 18:27:04 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:date:message-id:subject:from:to :content-type; bh=q88YRkICjUq/xNjjxPf8YeX9TVL1+ykGwI+bae3TblE=; b=l1ftfrqzJLThDVfVgHGGCKDeKZLe0VH/W0WhGyiRtT/HapAQRXKg3hnJD9Hth/H6NL 3i5ZF1IdTSGvFkiAyyjbfMxA3ArTEJGLk9SNBS2+2f/q4BnSV9mNwjTqGb5x0Jxwaplg joRdI8xzU50YfClVaxtYdBaEmveg7u/T6mdfVHUdWzpe84SR0yacQx6dSWvP5u6owDVr mXkK+QtdAFv9xked1DQmVDyHw4ed+ImvvKpWdBSNpStlsamBGFP6A1vkkR/S5+4/wqtA dSGnCLS8P5wYnhcZW8HJ/b2zKP8tSItCAXHmxQUtMeRFYGAUAZpBuNtThKaAxmez7Ta9 Dz7g== X-Gm-Message-State: ALoCoQk7R0HHUA+iGSXrQoaae43Aw8hnyxBW0UzPgodzXE1ukdw50JQCZ5xpiu+k6kY1AowhzDgJ MIME-Version: 1.0 X-Received: by 10.236.70.168 with SMTP id p28mr17408300yhd.21.1420511224330; Mon, 05 Jan 2015 18:27:04 -0800 (PST) Received: by 10.170.57.196 with HTTP; Mon, 5 Jan 2015 18:27:04 -0800 (PST) Date: Mon, 5 Jan 2015 18:27:04 -0800 Message-ID: Subject: Go patch committed: Use receiver type name in type descriptor name From: Ian Lance Taylor To: gcc-patches , "gofrontend-dev@googlegroups.com" If different named types have methods with the same name, and the methods with the same name define nested types with the same name, the type descriptors for those nested types could collide at link time. This patch by Chris Manghane fixes the problem. This is issue 33 in the gofrontend issue tracker. Bootstrapped and ran Go testsuite on x86_64-unknown-linux-gnu. Committed to mainline. Ian diff -r 3196a4d08deb go/types.cc --- a/go/types.cc Mon Jan 05 08:12:31 2015 -0800 +++ b/go/types.cc Mon Jan 05 18:23:58 2015 -0800 @@ -1296,6 +1296,14 @@ ret.append(1, '.'); if (in_function != NULL) { + const Typed_identifier* rcvr = + in_function->func_value()->type()->receiver(); + if (rcvr != NULL) + { + Named_type* rcvr_type = rcvr->type()->deref()->named_type(); + ret.append(Gogo::unpack_hidden_name(rcvr_type->name())); + ret.append(1, '.'); + } ret.append(Gogo::unpack_hidden_name(in_function->name())); ret.append(1, '.'); if (index > 0) @@ -9170,6 +9178,14 @@ name.append(1, '.'); if (this->in_function_ != NULL) { + const Typed_identifier* rcvr = + this->in_function_->func_value()->type()->receiver(); + if (rcvr != NULL) + { + Named_type* rcvr_type = rcvr->type()->deref()->named_type(); + name.append(Gogo::unpack_hidden_name(rcvr_type->name())); + name.append(1, '.'); + } name.append(Gogo::unpack_hidden_name(this->in_function_->name())); name.append(1, '$'); if (this->in_function_index_ > 0)