From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2140) id D71613858C31; Thu, 16 Feb 2023 11:12:50 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D71613858C31 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1676545970; bh=P56ElK1kz6rMyFx2aORJQYRJNhKn2j5aghPKdQwr2gc=; h=From:To:Subject:Date:From; b=SDCXXV3XQjKNg50fwsSiKRAA7+maLHIrQQ/ZBuzCBuiXowlQdw+norhTZGYkcs1aW ZxZjq6DoOgyWxymAL8kKjCB8ZVjeeDO1zU5b8hQKA48GvVdDUwZhaTcN7y5GFb2PMS KCMfV7L7J5e2Upq1f/DqRRckeY8m8PVIRvcm1VFA= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Alexandre Oliva To: gcc-cvs@gcc.gnu.org Subject: [gcc(refs/users/aoliva/heads/testme)] Accept pmf-vbit-in-delta extra warning X-Act-Checkin: gcc X-Git-Author: Alexandre Oliva X-Git-Refname: refs/users/aoliva/heads/testme X-Git-Oldrev: 87b355ad7d5e70bb3163fb8565a334d5d2bffd96 X-Git-Newrev: 238d6d615ee3965594eb5d8709176350ff8ea0fb Message-Id: <20230216111250.D71613858C31@sourceware.org> Date: Thu, 16 Feb 2023 11:12:50 +0000 (GMT) List-Id: https://gcc.gnu.org/g:238d6d615ee3965594eb5d8709176350ff8ea0fb commit 238d6d615ee3965594eb5d8709176350ff8ea0fb Author: Alexandre Oliva Date: Thu Feb 16 06:52:15 2023 -0300 Accept pmf-vbit-in-delta extra warning 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. for gcc/testsuite/ChangeLog * g++.dg/warn/Waddress-5.C: Tolerate extra -Waddress warning. Diff: --- 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 b1287b2fac3..1de88076f77 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" }