From patchwork Tue Jun 28 16:51:00 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: 55506 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id D5557385736C for ; Tue, 28 Jun 2022 16:51:42 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D5557385736C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1656435102; bh=Si4kM7Cqp4bNU1jfCviv9Gz/Fn6euXBt7H5GtDinT2M=; h=Date:Subject:To:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=v4sunrDlm5F3UNHTFZQveykmT5M9ffoqt9vmW3NXEgSdzs8nMXbq3BQrO3WW9zVu9 Qeghy04QdMVAZzQZ4eg78BSER6cpFVhDCZaxe0nuUi7JBLdkBAwn66B536YBD7Gtr3 L8wehj2CnSahhiKh9451FGCbHByywZJnq8dKnX+c= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-pl1-x633.google.com (mail-pl1-x633.google.com [IPv6:2607:f8b0:4864:20::633]) by sourceware.org (Postfix) with ESMTPS id C9F3A38582A6 for ; Tue, 28 Jun 2022 16:51:12 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org C9F3A38582A6 Received: by mail-pl1-x633.google.com with SMTP id q18so11560554pld.13 for ; Tue, 28 Jun 2022 09:51:12 -0700 (PDT) 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=Si4kM7Cqp4bNU1jfCviv9Gz/Fn6euXBt7H5GtDinT2M=; b=6E0udpbBe9OjVHNqCcdnmgMU7iyC6Bn5ivA+y8DsnSQjNxD4hs7cHJwYgKGgoqYvzM cS8SURQug8R24Nh2OA9OceTdBT3rqPg5lBBU23oRhYbeIFtF7JAQHjgwEHC3q5DvaJyG F0xBo7phP28t8SYBCI9WNODl5HSZh69bwkK3jmD+Hp+d0czRwvA/68xPUKOwNw4KNo7w 95M/KgUqEqLjlJzdS7PtK4OC47gVwgjYoIp859AMwFFYjsE+pdL0YuHRXidxC/gcii7G ee67a8ehLjAJTUdiAwVkf8u17rZo4Uuuv/J23O6xWPJNLxsG42CfpZjgyBjjT/hXHGCz 3ixQ== X-Gm-Message-State: AJIora83PhiEUHOPKhRErvZtX+jS1WTIqg9idzZjmNoNkU+NcrY04wah 4/padtXlf8LKArrUCwhSnX4eIiRZobDjDrfZxhJhJmDPJ2cpkA== X-Google-Smtp-Source: AGRyM1s4MxyiMvjvllJXXCcc5Xojn8bXQ9g5Lzv5F/8X5OVeRPgzRjIA4A2+llc3kmeOoBh3RmPIDlrAq3U14P0crls= X-Received: by 2002:a17:90b:1810:b0:1ed:28dd:c215 with SMTP id lw16-20020a17090b181000b001ed28ddc215mr613108pjb.18.1656435071561; Tue, 28 Jun 2022 09:51:11 -0700 (PDT) MIME-Version: 1.0 Date: Tue, 28 Jun 2022 09:51:00 -0700 Message-ID: Subject: Go patch committed: Permit abstract bool expressions to remain abstract To: gcc-patches , gofrontend-dev X-Spam-Status: No, score=-10.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) 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+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" This patch to the Go frontend permits expressions of abstract bool to remain abstract, rather than forcing them into the named type bool. The test case for this is https://go.dev/cl/414755. This fixes https://go.dev/issue/51475. Bootstrarpped and ran Go testsuite on x86_64-pc-linux-gnu. Committed to mainline. Ian eebc9c8f0b23acddea253eb5a44f59f44f3f466b diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE index 16d274ce99d..a0e386ab4f6 100644 --- a/gcc/go/gofrontend/MERGE +++ b/gcc/go/gofrontend/MERGE @@ -1,4 +1,4 @@ -927528cdc112fc51e0d07ee79e7a1254b586eabe +28fe9fad4acb4e02083faf5503b06e3e6e8eecaf 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/expressions.cc b/gcc/go/gofrontend/expressions.cc index f59f61d19ad..aadca9710e6 100644 --- a/gcc/go/gofrontend/expressions.cc +++ b/gcc/go/gofrontend/expressions.cc @@ -6829,11 +6829,12 @@ Binary_expression::do_determine_type(const Type_context* context) { if ((tleft->integer_type() != NULL && tright->integer_type() != NULL) || (tleft->float_type() != NULL && tright->float_type() != NULL) - || (tleft->complex_type() != NULL && tright->complex_type() != NULL)) + || (tleft->complex_type() != NULL && tright->complex_type() != NULL) + || (tleft->is_boolean_type() && tright->is_boolean_type())) { - // Both sides have an abstract integer, abstract float, or - // abstract complex type. Just let CONTEXT determine - // whether they may remain abstract or not. + // Both sides have an abstract integer, abstract float, + // abstract complex, or abstract boolean type. Just let + // CONTEXT determine whether they may remain abstract or not. } else if (tleft->complex_type() != NULL) subcontext.type = tleft;