From patchwork Thu Jul 12 04:18:55 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Lance Taylor X-Patchwork-Id: 942795 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-481398-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=golang.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="hhzrLZVz"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=golang-org.20150623.gappssmtp.com header.i=@golang-org.20150623.gappssmtp.com header.b="wpeZqseu"; dkim-atps=neutral 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 41R2kj73wyz9s01 for ; Thu, 12 Jul 2018 14:19:08 +1000 (AEST) 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=RTT3Tj3IkAQgyG2yhXNs9bTCG8m59COCNM3/U9r+ygZF6S b4L36uVowAr9aGzfvVTOeH8WpvKRSM0c+53iVeHtPRpbU3XdER/qhAE66IkU/Sla NeJkkqubXqIV4+vXOESIhQl6gQMxZbKAIp7Aw4ZapO7BIX9bg7DVtSjC27G6I= 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=5+0Rqip3+sxJAcSTU/V2FgHYDXI=; b=hhzrLZVztSkXhihlrBxm JL7bEwGO7rxwjAJB+Qnr45E7GA3A/svAgd5PUArQvBlfZ2Quuws4Z5VTpLSUx6pV mWbQRrU2XmASR8w87266RIKb/Hymb0wKuCOc/lsPESjysXoFtOeguK2ONkvcWyjl EiRqUS0IGJnB56m3Tb1DXM8= Received: (qmail 115290 invoked by alias); 12 Jul 2018 04:19:01 -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 114939 invoked by uid 89); 12 Jul 2018 04:19:00 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-11.2 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_2, GIT_PATCH_3, KAM_ASCII_DIVIDERS, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mail-lj1-f174.google.com Received: from mail-lj1-f174.google.com (HELO mail-lj1-f174.google.com) (209.85.208.174) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 12 Jul 2018 04:18:58 +0000 Received: by mail-lj1-f174.google.com with SMTP id r13-v6so20950675ljg.10 for ; Wed, 11 Jul 2018 21:18:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=golang-org.20150623.gappssmtp.com; s=20150623; h=mime-version:from:date:message-id:subject:to; bh=ejzhq77I1Q5y75aQUo+XbYzA8nh7LErCa1VDp/br3DM=; b=wpeZqseu/noMASRT815foXE0ppLz6QEY4ks4FQwcrZJck7RxrtP5iQF90R2iWaSlaj 6aiNzcm+uwj2FKgOAvta764Re2zrRqsEUBLvr3PlJxVAADliRoVFW4HvyDnx1GI3RqhG aH0PnmF/Otl4nyVVXs2wKEga9hvQFnBaDCc4vMCv+LyW8annJJ0c/bxuyNFBGEctAuqI akZSwbruc9Ku/bhzJtpWxKD9g6hvFmtr9T2jkw3oDvAgj//U9o7KKByQq7zWrFQFcuHc KalX/nM2Px28NC2CwERcVxkd/c44cnhDDn1UaLms4MWGVl3kYzw+R7afloYSq3k0MFsK WzCA== MIME-Version: 1.0 Received: by 2002:ab3:1d07:0:0:0:0:0 with HTTP; Wed, 11 Jul 2018 21:18:55 -0700 (PDT) From: Ian Lance Taylor Date: Wed, 11 Jul 2018 21:18:55 -0700 Message-ID: Subject: Go patch committed: Build a single backend type for a type alias To: gcc-patches , gofrontend-dev@googlegroups.com A type alias and its underlying type are identical. This patch to the Go frontend by Cherry Zhang builds a single backend type for them. Previously we build two backend types, which sometimes confuse the backend's type system. Also don't include type aliases into the list of named type declarations, since they are not named types. 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 262554) +++ gcc/go/gofrontend/MERGE (working copy) @@ -1,4 +1,4 @@ -ea7ac7784791dca517b6681a02c39c11bf136755 +267686fd1dffbc03e610e9f17dadb4e72c75f18d The first line of this file holds the git revision number of the last merge done from the gofrontend repository. Index: gcc/go/gofrontend/gogo.cc =================================================================== --- gcc/go/gofrontend/gogo.cc (revision 262540) +++ gcc/go/gofrontend/gogo.cc (working copy) @@ -7604,7 +7604,7 @@ Named_object::get_backend(Gogo* gogo, st case NAMED_OBJECT_TYPE: { Named_type* named_type = this->u_.type_value; - if (!Gogo::is_erroneous_name(this->name_)) + if (!Gogo::is_erroneous_name(this->name_) && !named_type->is_alias()) type_decls.push_back(named_type->get_backend(gogo)); // We need to produce a type descriptor for every named Index: gcc/go/gofrontend/types.cc =================================================================== --- gcc/go/gofrontend/types.cc (revision 262540) +++ gcc/go/gofrontend/types.cc (working copy) @@ -991,6 +991,11 @@ Type::get_backend(Gogo* gogo) if (this->btype_ != NULL) return this->btype_; + if (this->named_type() != NULL && this->named_type()->is_alias()) { + this->btype_ = this->unalias()->get_backend(gogo); + return this->btype_; + } + if (this->forward_declaration_type() != NULL || this->named_type() != NULL) return this->get_btype_without_hash(gogo);