From patchwork Thu Jan 6 19:24:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Lance Taylor X-Patchwork-Id: 1576264 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=M67HM8GP; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4JVGXG1X98z9sSs for ; Fri, 7 Jan 2022 06:25:16 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id DFC123858022 for ; Thu, 6 Jan 2022 19:25:13 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org DFC123858022 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1641497113; bh=yKDq6SRRWbDQF+1kmQzT2sV6MBxhSXLWpr35YwWIHGw=; h=Date:Subject:To:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=M67HM8GPD4ekOzETu0l+qXeSRZdZGskOi2IrzQ5G8MkX0+lqAZNBwNdToHGGdKQrl Sm+Bm2ec++GTR+81BngNZUdqtwM0dSkvODrkBP/qMU1/u6TSYBmfHUK9Lb8F3q8dP3 dQqQG341XEcF/XEevxIfqhUAglg7M35+qzgCClEU= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-ed1-x52c.google.com (mail-ed1-x52c.google.com [IPv6:2a00:1450:4864:20::52c]) by sourceware.org (Postfix) with ESMTPS id E43C83858408 for ; Thu, 6 Jan 2022 19:24:31 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org E43C83858408 Received: by mail-ed1-x52c.google.com with SMTP id 30so11740152edv.3 for ; Thu, 06 Jan 2022 11:24:31 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=yKDq6SRRWbDQF+1kmQzT2sV6MBxhSXLWpr35YwWIHGw=; b=rJOrUYXKMQU/+Eb84ZUZ+xOyoMuVigPio1bYpyndXAB2KhqmDmHSXa9qs4mHzBTGyv PaommGuWrJ35HIbxEBIw4A2Zx32R39rAlIxj0tqBRR0Ody61p8VXwFq1GeIuw/dphnLo 7baZJvpcv3/UXmpZuZtZAguP6BZKlGV9UPGKN+YoixbDJkQ4I4owy8oC5Shr6ehgxWqA m7ETfQT0HFkETz32rZYzMTFnBNCW+9hkETPD6LBxpzGVNOfvkLYzKXE4tyntHBg8QWhy ct6zLleEgqBt2sVHTw3vC3meL2Wf22qSMxu9BHCGq9CErXTMbtP4UZwgvi8WQRp8bb1E TRDQ== X-Gm-Message-State: AOAM532/zmQ+yjTTgVTNWjeuVhGNsiJBl4Hqcrzm23G/dNGaKu2wb5Id IcPqZ0bPoifOySexaNwDm+95j8uPDqtmykUEZ4gy9UgeLWHqkA== X-Google-Smtp-Source: ABdhPJw+YlI5we3py2I3Cgy9T7UqBhcEHhNi2en0+ESiXZ87JuX9VJnEfJBCPSD2gZUy7CTVXo0gQ7V8xFVZ/eaAw1A= X-Received: by 2002:a05:6402:230e:: with SMTP id l14mr49794086eda.370.1641497070503; Thu, 06 Jan 2022 11:24:30 -0800 (PST) MIME-Version: 1.0 Date: Thu, 6 Jan 2022 11:24:19 -0800 Message-ID: Subject: Go patch committed: Permit unnamed types when ignoring struct tags To: gcc-patches , gofrontend-dev X-Spam-Status: No, score=-9.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Ian Lance Taylor via Gcc-patches From: Ian Lance Taylor Reply-To: Ian Lance Taylor Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" This patch to the Go frontend permits converting unnamed types when ignoring struct tags. I think the code was written this way because before conversion could ignore struct tags this case could only arise with named types. Now that conversions permit struct tags to change, this can occur with unnamed types as well. The test case is https://golang.org/cl/375796. This fixes https://golang.org/issue/50439. Bootstrapped and ran Go testsuite on x86_64-pc-linux-gnu. Committed to mainline. Ian 89ce08665e128d2f8e9ae148044134d9e94a9509 diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE index a18f3a37349..9cc6a1c63c6 100644 --- a/gcc/go/gofrontend/MERGE +++ b/gcc/go/gofrontend/MERGE @@ -1,4 +1,4 @@ -9732b0766667b9235d0f35d0fb0abfe406b94d49 +799e9807c36fc661b14dfff136369556f09a5ebf The first line of this file holds the git revision number of the last merge done from the gofrontend repository. diff --git a/gcc/go/gofrontend/types.cc b/gcc/go/gofrontend/types.cc index 57c02a97ef0..1c67ea099eb 100644 --- a/gcc/go/gofrontend/types.cc +++ b/gcc/go/gofrontend/types.cc @@ -791,8 +791,7 @@ Type::are_convertible(const Type* lhs, const Type* rhs, std::string* reason) // The types are convertible if they have identical underlying // types, ignoring struct field tags. - if ((lhs->named_type() != NULL || rhs->named_type() != NULL) - && Type::are_identical(lhs->base(), rhs->base(), 0, reason)) + if (Type::are_identical(lhs->base(), rhs->base(), 0, reason)) return true; // The types are convertible if they are both unnamed pointer types