public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/users/aoliva/heads/testme)] Accept pmf-vbit-in-delta extra warning
@ 2023-02-22 14:49 Alexandre Oliva
  0 siblings, 0 replies; 2+ messages in thread
From: Alexandre Oliva @ 2023-02-22 14:49 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:affa36e396a3dced8be3b7da92e302323ed79a44

commit affa36e396a3dced8be3b7da92e302323ed79a44
Author: Alexandre Oliva <oliva@adacore.com>
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" }

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [gcc(refs/users/aoliva/heads/testme)] Accept pmf-vbit-in-delta extra warning
@ 2023-02-16 11:12 Alexandre Oliva
  0 siblings, 0 replies; 2+ messages in thread
From: Alexandre Oliva @ 2023-02-16 11:12 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:238d6d615ee3965594eb5d8709176350ff8ea0fb

commit 238d6d615ee3965594eb5d8709176350ff8ea0fb
Author: Alexandre Oliva <oliva@adacore.com>
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" }

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-02-22 14:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-22 14:49 [gcc(refs/users/aoliva/heads/testme)] Accept pmf-vbit-in-delta extra warning Alexandre Oliva
  -- strict thread matches above, loose matches on Subject: below --
2023-02-16 11:12 Alexandre Oliva

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).