From patchwork Fri Feb 17 07:02:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Oliva X-Patchwork-Id: 58369 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp739422wrn; Thu, 16 Feb 2023 23:03:13 -0800 (PST) X-Google-Smtp-Source: AK7set9DUDbYGRzR9DoJOmwca+EzpwaXX6dEXkCNM8ZbCW5nPCT0e6uoIy4DWzvN/+XbldhiO91i X-Received: by 2002:aa7:d553:0:b0:4ad:5950:3f47 with SMTP id u19-20020aa7d553000000b004ad59503f47mr3413058edr.9.1676617392926; Thu, 16 Feb 2023 23:03:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676617392; cv=none; d=google.com; s=arc-20160816; b=Xw8w3sWZyveNxajCXK8u3uODXCMsfmihhXEO6Xzs+TruroKUvWyf9DIYhKfpf0Hcq4 qx7sR8DfkmBFNiylSDAF4ivhjZRqVPqf2vVNewiO3vy9JpvhjeQJAa6BS4ADrbmnppII 8z4fBKsyjkXYzoAtzzyqvIzrD4aVKWfTX7yXJmjr/JSDrIitsT5GHbBVb3wiGcxgmT3X 4huhw4uvt0yobkXdlgqBBHUrdBdxogWscQEL0L9jwzrT0HZD4lkJEGtCYIr3Qic4URxZ 8/MTvHU7SJ8ElOR+tY2zE220KFrvdvqLSbbX51/FZfHqKtmLcV6ALTXwle/+d6kBIgho oG5Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence:mime-version :user-agent:message-id:date:organization:subject:cc:to:dmarc-filter :delivered-to:dkim-signature:dkim-filter; bh=5Ea9cZH7OAh7ZImDF3gRG/pkIRN0QziUwz3je3fd5A4=; b=jP7iPndoz1fc/wI/BD/bb2UwIRpEyDeL6T4WqFqNa5H0FBmuhR687/0I0lytDAgBeG lU2P2GzGBsOr0JA79S6A7eQg6E1vOW7ft3auZdCTPLW61s6VTY4qwO06WZr5cxVwtF8i Ku16TIlYiaqzX1pjUTfG5zHQhJv8sUpdJTfkI7R41reKJhsuOQYpSdgzZOPQRdQeHbny R9+Xhu0DkwTbpm892FcC2pQJ2Gxbs76T3yCTcXgu0H7emlFyDjGvyJHBcDxGPVbZTTxw dz4f2RMq/mPzJBcEnR2mbY3A+xu/doLiP2WAr2Wrj/+6CTzp08JRhx7TUwAjjKgSkLTE lieA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=mKLO4VYg; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id k1-20020a056402048100b004ad6fc891ddsi3003447edv.505.2023.02.16.23.03.12 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Feb 2023 23:03:12 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=mKLO4VYg; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id B26623858291 for ; Fri, 17 Feb 2023 07:03:11 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B26623858291 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1676617391; bh=5Ea9cZH7OAh7ZImDF3gRG/pkIRN0QziUwz3je3fd5A4=; h=To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=mKLO4VYgJUt7kUVNxftE9aMn4CfOsio9Slrh1nCLbqbIUV612F7jk04dgffNM+Bi7 ldv+esXlW69mVfZ7VknAcxqrrOgwvzBwhJcEhAbY44nmroncQuPp6lHdmhDjiRZkR/ DHdFQHY+pITCisoU5sLqcdcwRlevt62f0VlI3kpk= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from rock.gnat.com (rock.gnat.com [IPv6:2620:20:4000:0:a9e:1ff:fe9b:1d1]) by sourceware.org (Postfix) with ESMTPS id 842153858D33 for ; Fri, 17 Feb 2023 07:02:29 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 842153858D33 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 4C00B116B69; Fri, 17 Feb 2023 02:02:29 -0500 (EST) X-Virus-Scanned: Debian amavisd-new at gnat.com Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id pG5yUAMhtVDh; Fri, 17 Feb 2023 02:02:29 -0500 (EST) Received: from free.home (tron.gnat.com [IPv6:2620:20:4000:0:46a8:42ff:fe0e:e294]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by rock.gnat.com (Postfix) with ESMTPS id C7E37116B60; Fri, 17 Feb 2023 02:02:28 -0500 (EST) Received: from livre (livre.home [172.31.160.2]) by free.home (8.15.2/8.15.2) with ESMTPS id 31H723OQ090739 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Fri, 17 Feb 2023 04:02:04 -0300 To: gcc-patches@gcc.gnu.org Cc: jason@redhat.com, nathan@acm.org, nickc@redhat.com, richard.earnshaw@arm.com, ramana.gcc@gmail.com, kyrylo.tkachov@arm.com, ro@CeBiTec.Uni-Bielefeld.DE, mikestump@comcast.net Subject: [PATCH] Accept pmf-vbit-in-delta extra warning Organization: Free thinker, does not speak for AdaCore Date: Fri, 17 Feb 2023 04:02:03 -0300 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 X-Spam-Status: No, score=-12.3 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, SPF_HELO_NONE, SPF_PASS, TXREP 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: Alexandre Oliva via Gcc-patches From: Alexandre Oliva Reply-To: Alexandre Oliva Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1758060759515312932?= X-GMAIL-MSGID: =?utf-8?q?1758060759515312932?= cp_build_binary_op, that issues -Waddress warnings, issues an extra warning on arm targets, that g++.dg/warn/Waddress-5.C does not expect when comparing a pointer-to-member-function literal with null. The reason for the extra warning is that, on arm targets, TARGET_PTRMEMFUNC_VBIT_LOCATION == ptrmemfunc_vbit_in_delta, which causes a different path to be taken, that extracts the pointer-to-function and the delta fields (minus the vbit) and compares each one with zero. It's when comparing this pointer-to-function with zero, in a recursive cp_build_binary_op, that another warning is issued. I suppose there should be a way to skip the warning in this recursive call, without disabling other warnings that might be issued there, but this patch only arranges for the test to tolerate the extra warning. Regstrapped on x86_64-linux-gnu. Tested on arm-vxworks7 (gcc-12) and arm-eabi (trunk). Ok to install? for gcc/testsuite/ChangeLog * g++.dg/warn/Waddress-5.C: Tolerate extra -Waddress warning. --- gcc/testsuite/g++.dg/warn/Waddress-5.C | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/gcc/testsuite/g++.dg/warn/Waddress-5.C b/gcc/testsuite/g++.dg/warn/Waddress-5.C index b1287b2fac316..1de88076f7767 100644 --- a/gcc/testsuite/g++.dg/warn/Waddress-5.C +++ b/gcc/testsuite/g++.dg/warn/Waddress-5.C @@ -23,7 +23,11 @@ void T (bool); void warn_memptr_if () { // Exercise warnings for addresses of nonstatic member functions. - if (&A::f == 0) // { dg-warning "the address '&A::f'" } + // On targets with TARGET_PTRMEMFUNC_VBIT_LOCATION == + // ptrmemfunc_vbit_in_delta, cp_build_binary_op recurses to compare + // the pfn from the ptrmemfunc with null, so we get two warnings. + // This matches both. ??? Should we disable one of them? + if (&A::f == 0) // { dg-warning "A::f" } T (0); if (&A::vf) // { dg-warning "-Waddress" }