From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2140) id 088CA385828D; Wed, 22 Feb 2023 14:49:18 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 088CA385828D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1677077358; bh=eAFhqgdYOIQPp2YVi8Ase0KXgMybb6Pb4sdvfKusdPE=; h=From:To:Subject:Date:From; b=xOAJq4cityNk5O9QtkWflJt0c4C0Ch31W8ay1mTFb0X7+GTXVFB7rNAFAM6GOr4g8 Xo+EZ9EObEjPtYp+4V9ZTg2xY6CXTRz4kYa8qT2pqrXYpYOzv/setaBnOAqgL/Tcoz 2vohIAwQz1hir8lnzvaGhJdaTjhQxEWwjkCbFsv0= 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: edc86db529152e5d9a0c49764c3bcae81fda3292 X-Git-Newrev: affa36e396a3dced8be3b7da92e302323ed79a44 Message-Id: <20230222144918.088CA385828D@sourceware.org> Date: Wed, 22 Feb 2023 14:49:18 +0000 (GMT) List-Id: https://gcc.gnu.org/g:affa36e396a3dced8be3b7da92e302323ed79a44 commit affa36e396a3dced8be3b7da92e302323ed79a44 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" }