public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/vendors/ARM/heads/morello)] testsuite: Fixes for -Wcheri-capability-misuse
@ 2022-11-01 11:01 Alex Coplan
  0 siblings, 0 replies; only message in thread
From: Alex Coplan @ 2022-11-01 11:01 UTC (permalink / raw)
  To: gcc-cvs

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

commit dfd24013eb422e9fd215d239e15c7a3520a14e88
Author: Alex Coplan <alex.coplan@arm.com>
Date:   Tue Oct 18 22:43:26 2022 +0100

    testsuite: Fixes for -Wcheri-capability-misuse
    
    This patch adjusts the testsuite for the following recent changes:
     - -Wcheri-capability-misuse has been pulled out as a separate warning
       from -Wint-to-pointer-cast
     - The C++ frontend now implements -Wcheri-capability-misuse (now at
       parity with the C frontend).
    
    We also take the opportunity to fix up a pre-existing issue whereby all
    the dg-warning directives looking for this warning were gated on
    aarch64_capability_any, which includes hybrid, but of course these
    warnings aren't expected to be triggered on hybrid.
    
    To fix this issue we introduce a new effective-target
    "cheri_pointers_are_caps", which is enabled for purecap and
    fake-capability Morello but not for hybrid CHERI. We then use this to
    gate the dg-warning directives.

Diff:
---
 gcc/testsuite/c-c++-common/Waddress-1.c                 |  2 +-
 gcc/testsuite/c-c++-common/Wint-to-pointer-cast-1.c     |  2 +-
 gcc/testsuite/c-c++-common/Wint-to-pointer-cast-2.c     |  2 +-
 gcc/testsuite/c-c++-common/Wint-to-pointer-cast-3.c     |  2 +-
 gcc/testsuite/g++.dg/conversion/reinterpret2.C          |  2 +-
 gcc/testsuite/g++.dg/cpp0x/constexpr-52672.C            |  1 +
 gcc/testsuite/g++.dg/cpp0x/ref-bind7.C                  |  1 +
 gcc/testsuite/g++.dg/ext/attr-copy-2.C                  |  3 ++-
 gcc/testsuite/g++.dg/other/increment1.C                 |  1 +
 gcc/testsuite/g++.dg/torture/pr68064.C                  |  1 +
 gcc/testsuite/g++.old-deja/g++.mike/warn1.C             |  1 +
 gcc/testsuite/g++.old-deja/g++.pt/local1.C              |  1 +
 gcc/testsuite/g++.old-deja/g++.pt/local7.C              |  1 +
 gcc/testsuite/gcc.dg/Wbuiltin-declaration-mismatch-13.c | 10 +++++-----
 gcc/testsuite/gcc.dg/Wpointer-to-int-cast-3.c           |  2 +-
 gcc/testsuite/gcc.dg/Wreturn-local-addr-3.c             |  4 ++--
 gcc/testsuite/gcc.dg/attr-copy-8.c                      |  3 ++-
 gcc/testsuite/gcc.dg/c90-const-expr-2.c                 |  6 +++---
 gcc/testsuite/gcc.dg/c90-const-expr-3.c                 |  2 +-
 gcc/testsuite/gcc.dg/c99-const-expr-2.c                 |  4 ++--
 gcc/testsuite/gcc.dg/c99-const-expr-3.c                 |  2 +-
 gcc/testsuite/gcc.dg/cast-1.c                           |  2 +-
 gcc/testsuite/gcc.dg/cast-2.c                           |  2 +-
 gcc/testsuite/gcc.dg/cast-3.c                           |  2 +-
 gcc/testsuite/gcc.dg/format/cast-1.c                    |  2 +-
 gcc/testsuite/gcc.dg/format/nonlit-1.c                  |  2 +-
 gcc/testsuite/gcc.dg/format/nonlit-2.c                  |  2 +-
 gcc/testsuite/gcc.dg/inline-16.c                        |  2 +-
 gcc/testsuite/gcc.dg/ipa/ipa-pta-13.c                   |  2 +-
 gcc/testsuite/gcc.dg/pr37561.c                          |  8 ++++----
 gcc/testsuite/gcc.dg/pr49544.c                          |  2 +-
 gcc/testsuite/gcc.dg/pr50908.c                          | 10 +++++-----
 gcc/testsuite/gcc.dg/pr52549.c                          |  2 +-
 gcc/testsuite/gcc.dg/pr64536.c                          |  4 ++--
 gcc/testsuite/gcc.dg/pr65658.c                          |  2 +-
 gcc/testsuite/gcc.dg/pr70920-3.c                        |  2 +-
 gcc/testsuite/gcc.dg/pr94188.c                          |  2 +-
 gcc/testsuite/gcc.dg/pr94436.c                          |  2 +-
 gcc/testsuite/gcc.dg/pr94600-1.c                        |  2 +-
 gcc/testsuite/gcc.dg/pr94600-2.c                        | 12 ++++++------
 gcc/testsuite/gcc.dg/pr94600-3.c                        |  2 +-
 gcc/testsuite/gcc.dg/pr94600-4.c                        | 12 ++++++------
 gcc/testsuite/gcc.dg/sms-5.c                            |  2 +-
 gcc/testsuite/gcc.dg/struct-ret-3.c                     |  2 +-
 gcc/testsuite/gcc.dg/torture/20200311-1.c               |  2 +-
 gcc/testsuite/gcc.dg/torture/pr28814.c                  |  2 +-
 gcc/testsuite/gcc.dg/torture/pr29584.c                  |  2 +-
 gcc/testsuite/gcc.dg/torture/pr57864.c                  |  4 ++--
 gcc/testsuite/gcc.dg/torture/pr61095.c                  |  2 +-
 gcc/testsuite/gcc.dg/tree-ssa/strlen-1.c                |  2 +-
 gcc/testsuite/gcc.dg/vect/pr32230.c                     |  2 +-
 gcc/testsuite/gcc.dg/vect/pr33833.c                     |  2 +-
 gcc/testsuite/gcc.dg/vla-11.c                           |  2 +-
 gcc/testsuite/gcc.dg/vla-9.c                            |  2 +-
 gcc/testsuite/lib/target-supports.exp                   | 13 +++++++++++++
 55 files changed, 96 insertions(+), 74 deletions(-)

diff --git a/gcc/testsuite/c-c++-common/Waddress-1.c b/gcc/testsuite/c-c++-common/Waddress-1.c
index 79f4ac723e5..2b2b2577f3d 100644
--- a/gcc/testsuite/c-c++-common/Waddress-1.c
+++ b/gcc/testsuite/c-c++-common/Waddress-1.c
@@ -11,6 +11,6 @@ foo ()
     && "foo2" != (const char *) ((void *) 0)	/* { dg-bogus "comparison with string literal results in unspecified behavior" } */
     && "foo3" != (const char *) ((void *) (10 - 10))	/* { dg-bogus "comparison with string literal results in unspecified behavior" } */
     && "foo4" != (const char *) ((void *) (&e - &e))	/* { dg-warning "15:comparison with string literal results in unspecified behavior" "" { target { c && { ! aarch64_capability_any } } } } */
-    /* { dg-warning "cast from provenance-free integer type to pointer type will give pointer that can not be dereferenced" "" { target { aarch64_capability_any } } .-1 } */
+    /* { dg-warning "cast from provenance-free integer type to pointer type will give pointer that can not be dereferenced" "" { target { cheri_pointers_are_caps } } .-1 } */
     && "foo5" != "foo6";	/* { dg-warning "15:comparison with string literal results in unspecified behavior" } */
 }
diff --git a/gcc/testsuite/c-c++-common/Wint-to-pointer-cast-1.c b/gcc/testsuite/c-c++-common/Wint-to-pointer-cast-1.c
index 31e6f07bc55..5c15a660981 100644
--- a/gcc/testsuite/c-c++-common/Wint-to-pointer-cast-1.c
+++ b/gcc/testsuite/c-c++-common/Wint-to-pointer-cast-1.c
@@ -9,5 +9,5 @@ void *
 f (void)
 {
   return (void *) c; /* { dg-warning "10:cast to pointer from integer of different size" } */
-  /* { dg-warning "cast from provenance-free integer type to pointer type will give pointer that can not be dereferenced" "" { target { aarch64_capability_any } } .-1 } */
+  /* { dg-warning "cast from provenance-free integer type to pointer type will give pointer that can not be dereferenced" "" { target { cheri_pointers_are_caps } } .-1 } */
 }
diff --git a/gcc/testsuite/c-c++-common/Wint-to-pointer-cast-2.c b/gcc/testsuite/c-c++-common/Wint-to-pointer-cast-2.c
index 96c2ae14c97..f7fe45c2622 100644
--- a/gcc/testsuite/c-c++-common/Wint-to-pointer-cast-2.c
+++ b/gcc/testsuite/c-c++-common/Wint-to-pointer-cast-2.c
@@ -9,5 +9,5 @@ void *
 f (void)
 {
   return (void *) c; /* { dg-warning "10:cast to pointer from integer of different size" } */
-  /* { dg-warning "cast from provenance-free integer type to pointer type will give pointer that can not be dereferenced" "" { target { aarch64_capability_any } } .-1 } */
+  /* { dg-warning "cast from provenance-free integer type to pointer type will give pointer that can not be dereferenced" "" { target { cheri_pointers_are_caps } } .-1 } */
 }
diff --git a/gcc/testsuite/c-c++-common/Wint-to-pointer-cast-3.c b/gcc/testsuite/c-c++-common/Wint-to-pointer-cast-3.c
index 0ac35b2c5bc..c55ead6e11f 100644
--- a/gcc/testsuite/c-c++-common/Wint-to-pointer-cast-3.c
+++ b/gcc/testsuite/c-c++-common/Wint-to-pointer-cast-3.c
@@ -8,7 +8,7 @@ char c;
 void *
 f (void)
 {
-  return (void *) c;
+  return (void *) c; /* { dg-warning "cast from provenance-free integer type to pointer type" "" { target { cheri_pointers_are_caps } } } */
 }
 
 void *p;
diff --git a/gcc/testsuite/g++.dg/conversion/reinterpret2.C b/gcc/testsuite/g++.dg/conversion/reinterpret2.C
index e9b2328b74d..4f02da4ac84 100644
--- a/gcc/testsuite/g++.dg/conversion/reinterpret2.C
+++ b/gcc/testsuite/g++.dg/conversion/reinterpret2.C
@@ -1,5 +1,5 @@
 bool b;
 
 void f() {
-  reinterpret_cast<void*>(b);
+  reinterpret_cast<void*>(b); /* { dg-warning "cast from provenance-free integer type to pointer type" "" { target { cheri_pointers_are_caps } } } */
 }
diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-52672.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-52672.C
index 0ce07a5b013..20c5164fc3a 100644
--- a/gcc/testsuite/g++.dg/cpp0x/constexpr-52672.C
+++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-52672.C
@@ -1,5 +1,6 @@
 // PR c++/52672
 // { dg-do compile { target c++11 } }
+// { dg-additional-options "-Wno-cheri-capability-misuse" { target { cheri_pointers_are_caps } } }
 
 __extension__ typedef __SIZE_TYPE__ * ul_ptr;
 constexpr unsigned long a = *((ul_ptr)0x0); // { dg-error "" }
diff --git a/gcc/testsuite/g++.dg/cpp0x/ref-bind7.C b/gcc/testsuite/g++.dg/cpp0x/ref-bind7.C
index e3675bc560d..cf3c19e7781 100644
--- a/gcc/testsuite/g++.dg/cpp0x/ref-bind7.C
+++ b/gcc/testsuite/g++.dg/cpp0x/ref-bind7.C
@@ -11,3 +11,4 @@ class B {
 };
 long f;
 void B::d() { e.c((const int *)f); }
+// { dg-warning "cast from provenance-free integer type to pointer type" "" { target { cheri_pointers_are_caps } } .-1 }
diff --git a/gcc/testsuite/g++.dg/ext/attr-copy-2.C b/gcc/testsuite/g++.dg/ext/attr-copy-2.C
index 7776959d9f6..3e6bd8ec5dc 100644
--- a/gcc/testsuite/g++.dg/ext/attr-copy-2.C
+++ b/gcc/testsuite/g++.dg/ext/attr-copy-2.C
@@ -1,6 +1,7 @@
 /* PR c/89685 - ICE on attribute copy with a compound expression
    { dg-do compile }
-   { dg-options "-Wall -Wno-unused-value -Wno-int-to-pointer-cast" } */
+   { dg-options "-Wall -Wno-unused-value -Wno-int-to-pointer-cast" }
+   { dg-additional-options "-Wno-cheri-capability-misuse" { target { cheri_pointers_are_caps } } } */
 
 #if __cplusplus <= 199711L
 #  define static_assert(expr) typedef char Assert [1 - !(expr) * 2]
diff --git a/gcc/testsuite/g++.dg/other/increment1.C b/gcc/testsuite/g++.dg/other/increment1.C
index 506157ef24e..f1fd8fa7ee0 100644
--- a/gcc/testsuite/g++.dg/other/increment1.C
+++ b/gcc/testsuite/g++.dg/other/increment1.C
@@ -1,6 +1,7 @@
 // PR c++/37561
 // { dg-do compile }
 // { dg-options "-Wno-int-to-pointer-cast" }
+// { dg-additional-options "-Wno-cheri-capability-misuse" { target { cheri_pointers_are_caps } } }
 
 __PTRDIFF_TYPE__ p;
 char q;
diff --git a/gcc/testsuite/g++.dg/torture/pr68064.C b/gcc/testsuite/g++.dg/torture/pr68064.C
index 59b68973f38..32963e76b16 100644
--- a/gcc/testsuite/g++.dg/torture/pr68064.C
+++ b/gcc/testsuite/g++.dg/torture/pr68064.C
@@ -22,6 +22,7 @@ struct C {
   static A<C> *from_bitset(unsigned);
 };
 A<C> *C::from_bitset(unsigned p1) { return reinterpret_cast<A<C> *>(p1); }
+// { dg-warning "cast from provenance-free integer type to pointer type" "" { target { cheri_pointers_are_caps } } .-1 }
 
 namespace {
 int *a;
diff --git a/gcc/testsuite/g++.old-deja/g++.mike/warn1.C b/gcc/testsuite/g++.old-deja/g++.mike/warn1.C
index 5d6fdec5291..a329f8fc19b 100644
--- a/gcc/testsuite/g++.old-deja/g++.mike/warn1.C
+++ b/gcc/testsuite/g++.old-deja/g++.mike/warn1.C
@@ -1,5 +1,6 @@
 // { dg-do assemble  }
 // { dg-options "-Wall -Wno-int-to-pointer-cast" }
+// { dg-additional-options "-Wno-cheri-capability-misuse" { target { cheri_pointers_are_caps } } }
 
 typedef char * charptr;
 typedef __SIZE_TYPE__ size_t;
diff --git a/gcc/testsuite/g++.old-deja/g++.pt/local1.C b/gcc/testsuite/g++.old-deja/g++.pt/local1.C
index d73a0300167..b28da2f239d 100644
--- a/gcc/testsuite/g++.old-deja/g++.pt/local1.C
+++ b/gcc/testsuite/g++.old-deja/g++.pt/local1.C
@@ -6,6 +6,7 @@ setback(MEMBER *bp, MEMBER STRUCT::*offset)
         union { int i; MEMBER STRUCT::*of; } u;
         u.of = offset;
         return (STRUCT *) ((__SIZE_TYPE__) bp - u.i);
+// { dg-warning "cast from provenance-free integer type to pointer type" "" { target { cheri_pointers_are_caps } } .-1 }
 }
  
 
diff --git a/gcc/testsuite/g++.old-deja/g++.pt/local7.C b/gcc/testsuite/g++.old-deja/g++.pt/local7.C
index 96b19fc64c9..e1818ef437a 100644
--- a/gcc/testsuite/g++.old-deja/g++.pt/local7.C
+++ b/gcc/testsuite/g++.old-deja/g++.pt/local7.C
@@ -7,6 +7,7 @@ setback(MEMBER *bp, MEMBER STRUCT::*offset)
         union { int i; MEMBER STRUCT::*of; } u;
         u.of = offset;
         return (STRUCT *) ((__SIZE_TYPE__) bp - u.i);
+// { dg-warning "cast from provenance-free integer type to pointer type" "" { target { cheri_pointers_are_caps } } .-1 }
 }
  
 
diff --git a/gcc/testsuite/gcc.dg/Wbuiltin-declaration-mismatch-13.c b/gcc/testsuite/gcc.dg/Wbuiltin-declaration-mismatch-13.c
index 2f378bbd626..71def758f1a 100644
--- a/gcc/testsuite/gcc.dg/Wbuiltin-declaration-mismatch-13.c
+++ b/gcc/testsuite/gcc.dg/Wbuiltin-declaration-mismatch-13.c
@@ -10,7 +10,7 @@ void* ret_calloc (size_t n1, size_t n2)
   extern size_t calloc (size_t, size_t);    // { dg-warning "\\\[-Wbuiltin-declaration-mismatch" }
 
   return (void *) calloc (n1, n2);
-  /* { dg-warning "cast from provenance-free integer type to pointer type will give pointer that can not be dereferenced" "" { target { aarch64_capability_any } } .-1 } */
+  /* { dg-warning "cast from provenance-free integer type to pointer type will give pointer that can not be dereferenced" "" { target { cheri_pointers_are_caps } } .-1 } */
 }
 
 void* ret_malloc (size_t n)
@@ -18,7 +18,7 @@ void* ret_malloc (size_t n)
   extern size_t malloc (size_t);            // { dg-warning "\\\[-Wbuiltin-declaration-mismatch" }
 
   return (void *) malloc (n);
-  /* { dg-warning "cast from provenance-free integer type to pointer type will give pointer that can not be dereferenced" "" { target { aarch64_capability_any } } .-1 } */
+  /* { dg-warning "cast from provenance-free integer type to pointer type will give pointer that can not be dereferenced" "" { target { cheri_pointers_are_caps } } .-1 } */
 }
 
 void* ret_realloc (void *p, size_t n)
@@ -26,7 +26,7 @@ void* ret_realloc (void *p, size_t n)
   extern size_t realloc (void *p, size_t);  // { dg-warning "\\\[-Wbuiltin-declaration-mismatch" }
 
   return (void *) realloc (p, n);
-  /* { dg-warning "cast from provenance-free integer type to pointer type will give pointer that can not be dereferenced" "" { target { aarch64_capability_any } } .-1 } */
+  /* { dg-warning "cast from provenance-free integer type to pointer type will give pointer that can not be dereferenced" "" { target { cheri_pointers_are_caps } } .-1 } */
 }
 
 void* ret_strdup (const char *s)
@@ -34,7 +34,7 @@ void* ret_strdup (const char *s)
   extern size_t strdup (const char*);       // { dg-warning "\\\[-Wbuiltin-declaration-mismatch" }
 
   return (void *) strdup (s);
-  /* { dg-warning "cast from provenance-free integer type to pointer type will give pointer that can not be dereferenced" "" { target { aarch64_capability_any } } .-1 } */
+  /* { dg-warning "cast from provenance-free integer type to pointer type will give pointer that can not be dereferenced" "" { target { cheri_pointers_are_caps } } .-1 } */
 }
 
 void* ret_strndup (const char *s, size_t n)
@@ -43,7 +43,7 @@ void* ret_strndup (const char *s, size_t n)
     strndup (const char*, size_t);          // { dg-warning "\\\[-Wbuiltin-declaration-mismatch" }
 
   return (void *) strndup (s, n);
-  /* { dg-warning "cast from provenance-free integer type to pointer type will give pointer that can not be dereferenced" "" { target { aarch64_capability_any } } .-1 } */
+  /* { dg-warning "cast from provenance-free integer type to pointer type will give pointer that can not be dereferenced" "" { target { cheri_pointers_are_caps } } .-1 } */
 }
 
 // For good measure also exerise strcmp return type (not part of the bug).
diff --git a/gcc/testsuite/gcc.dg/Wpointer-to-int-cast-3.c b/gcc/testsuite/gcc.dg/Wpointer-to-int-cast-3.c
index 79e0cb53c6c..2e6cd2cb81e 100644
--- a/gcc/testsuite/gcc.dg/Wpointer-to-int-cast-3.c
+++ b/gcc/testsuite/gcc.dg/Wpointer-to-int-cast-3.c
@@ -18,5 +18,5 @@ void *
 g (void)
 {
   return (void *) c; /* { dg-warning "cast to pointer from integer of different size" } */
-  /* { dg-warning "cast from provenance-free integer type to pointer type will give pointer that can not be dereferenced" "" { target { aarch64_capability_any } } .-1 } */
+  /* { dg-warning "cast from provenance-free integer type to pointer type will give pointer that can not be dereferenced" "" { target { cheri_pointers_are_caps } } .-1 } */
 }
diff --git a/gcc/testsuite/gcc.dg/Wreturn-local-addr-3.c b/gcc/testsuite/gcc.dg/Wreturn-local-addr-3.c
index 23d1a638fb7..9280becd642 100644
--- a/gcc/testsuite/gcc.dg/Wreturn-local-addr-3.c
+++ b/gcc/testsuite/gcc.dg/Wreturn-local-addr-3.c
@@ -22,7 +22,7 @@ return_local_diff_cst (void)
 {
   int a[5];
   void *p = (void*)(&a[4] - &a[1]);
-  /* { dg-warning "cast from provenance-free integer type to pointer type will give pointer that can not be dereferenced" "" { target { aarch64_capability_any } } .-1 } */
+  /* { dg-warning "cast from provenance-free integer type to pointer type will give pointer that can not be dereferenced" "" { target { cheri_pointers_are_caps } } .-1 } */
   return p;
 }
 
@@ -31,7 +31,7 @@ return_local_diff_var (int i, int j)
 {
   int a[5];
   void *p = (void*)(&a[j] - &a[i]);
-  /* { dg-warning "cast from provenance-free integer type to pointer type will give pointer that can not be dereferenced" "" { target { aarch64_capability_any } } .-1 } */
+  /* { dg-warning "cast from provenance-free integer type to pointer type will give pointer that can not be dereferenced" "" { target { cheri_pointers_are_caps } } .-1 } */
   return p;
 }
 
diff --git a/gcc/testsuite/gcc.dg/attr-copy-8.c b/gcc/testsuite/gcc.dg/attr-copy-8.c
index 7195f6b19f8..4d6b4def0b7 100644
--- a/gcc/testsuite/gcc.dg/attr-copy-8.c
+++ b/gcc/testsuite/gcc.dg/attr-copy-8.c
@@ -1,6 +1,7 @@
 /* PR c/89685 - ICE on attribute copy with a compound expression
    { dg-do compile }
-   { dg-options "-Wall -Wno-unused-value -Wno-int-to-pointer-cast" } */
+   { dg-options "-Wall -Wno-unused-value -Wno-int-to-pointer-cast" }
+   { dg-additional-options "-Wno-cheri-capability-misuse" { target { cheri_pointers_are_caps } } } */
 
 #define ATTR(...) __attribute__ ((__VA_ARGS__))
 
diff --git a/gcc/testsuite/gcc.dg/c90-const-expr-2.c b/gcc/testsuite/gcc.dg/c90-const-expr-2.c
index 3f4293c2dca..7d2f072f29c 100644
--- a/gcc/testsuite/gcc.dg/c90-const-expr-2.c
+++ b/gcc/testsuite/gcc.dg/c90-const-expr-2.c
@@ -39,10 +39,10 @@ foo (void)
   ASSERT_NOT_NPC ((void *)(void *)0); /* { dg-bogus "incompatible" "bogus null pointer constant" } */
   ASSERT_NOT_NPC ((void *)(char *)0); /* { dg-bogus "incompatible" "bogus null pointer constant" } */
   ASSERT_NOT_NPC ((void *)(0, ZERO)); /* { dg-bogus "incompatible" "bogus null pointer constant" } */
-  /* { dg-warning "cast from provenance-free integer type to pointer type will give pointer that can not be dereferenced" "" { target { aarch64_capability_any } } .-1 } */
+  /* { dg-warning "cast from provenance-free integer type to pointer type will give pointer that can not be dereferenced" "" { target { cheri_pointers_are_caps } } .-1 } */
   ASSERT_NOT_NPC ((void *)(&"Foobar"[0] - &"Foobar"[0])); /* { dg-bogus "incompatible" "bogus null pointer constant" } */
-  /* { dg-warning "cast from provenance-free integer type to pointer type will give pointer that can not be dereferenced" "" { target { aarch64_capability_any } } .-1 } */
+  /* { dg-warning "cast from provenance-free integer type to pointer type will give pointer that can not be dereferenced" "" { target { cheri_pointers_are_caps } } .-1 } */
   /* This last one is a null pointer constant in C99 only.  */
   ASSERT_NOT_NPC ((void *)(1 ? ZERO : (0, ZERO))); /* { dg-bogus "incompatible" "bogus null pointer constant" } */
-  /* { dg-warning "cast from provenance-free integer type to pointer type will give pointer that can not be dereferenced" "" { target { aarch64_capability_any } } .-1 } */
+  /* { dg-warning "cast from provenance-free integer type to pointer type will give pointer that can not be dereferenced" "" { target { cheri_pointers_are_caps } } .-1 } */
 }
diff --git a/gcc/testsuite/gcc.dg/c90-const-expr-3.c b/gcc/testsuite/gcc.dg/c90-const-expr-3.c
index 60b486684cd..da2428d25ca 100644
--- a/gcc/testsuite/gcc.dg/c90-const-expr-3.c
+++ b/gcc/testsuite/gcc.dg/c90-const-expr-3.c
@@ -21,7 +21,7 @@ long *c;
    expressions has type 'void *' instead of 'int *'.
 */
 #define ASSERT_NOT_NPC(n)	(c = (1 ? a : (void *)(__SIZE_TYPE__)(n)))
-/* { dg-warning "cast from provenance-free integer type to pointer type will give pointer that can not be dereferenced" "" { target { aarch64_capability_any } } .-1 } */
+/* { dg-warning "cast from provenance-free integer type to pointer type will give pointer that can not be dereferenced" "" { target { cheri_pointers_are_caps } } .-1 } */
 
 void
 foo (void)
diff --git a/gcc/testsuite/gcc.dg/c99-const-expr-2.c b/gcc/testsuite/gcc.dg/c99-const-expr-2.c
index aadacfa043b..e4b201a7546 100644
--- a/gcc/testsuite/gcc.dg/c99-const-expr-2.c
+++ b/gcc/testsuite/gcc.dg/c99-const-expr-2.c
@@ -39,9 +39,9 @@ foo (void)
   ASSERT_NOT_NPC ((void *)(void *)0); /* { dg-bogus "incompatible" "bogus null pointer constant" } */
   ASSERT_NOT_NPC ((void *)(char *)0); /* { dg-bogus "incompatible" "bogus null pointer constant" } */
   ASSERT_NOT_NPC ((void *)(0, ZERO)); /* { dg-bogus "incompatible" "bogus null pointer constant" } */
-  /* { dg-warning "cast from provenance-free integer type to pointer type will give pointer that can not be dereferenced" "" { target { aarch64_capability_any } } .-1 } */
+  /* { dg-warning "cast from provenance-free integer type to pointer type will give pointer that can not be dereferenced" "" { target { cheri_pointers_are_caps } } .-1 } */
   ASSERT_NOT_NPC ((void *)(&"Foobar"[0] - &"Foobar"[0])); /* { dg-bogus "incompatible" "bogus null pointer constant" } */
-  /* { dg-warning "cast from provenance-free integer type to pointer type will give pointer that can not be dereferenced" "" { target { aarch64_capability_any } } .-1 } */
+  /* { dg-warning "cast from provenance-free integer type to pointer type will give pointer that can not be dereferenced" "" { target { cheri_pointers_are_caps } } .-1 } */
   /* This last one is a null pointer constant in C99 only.  */
   ASSERT_NPC ((void *)(1 ? 0 : (0, 0)));
 }
diff --git a/gcc/testsuite/gcc.dg/c99-const-expr-3.c b/gcc/testsuite/gcc.dg/c99-const-expr-3.c
index 5510fe34d59..ff1de9f611b 100644
--- a/gcc/testsuite/gcc.dg/c99-const-expr-3.c
+++ b/gcc/testsuite/gcc.dg/c99-const-expr-3.c
@@ -20,7 +20,7 @@ long *c;
    expressions has type 'void *' instead of 'int *'.
 */
 #define ASSERT_NOT_NPC(n)	(c = (1 ? a : (void *)(__SIZE_TYPE__)(n)))
-/* { dg-warning "cast from provenance-free integer type to pointer type will give pointer that can not be dereferenced" "" { target { aarch64_capability_any } } .-1 } */
+/* { dg-warning "cast from provenance-free integer type to pointer type will give pointer that can not be dereferenced" "" { target { cheri_pointers_are_caps } } .-1 } */
 
 void
 foo (void)
diff --git a/gcc/testsuite/gcc.dg/cast-1.c b/gcc/testsuite/gcc.dg/cast-1.c
index 9f1bd83ef1b..fd1866252b1 100644
--- a/gcc/testsuite/gcc.dg/cast-1.c
+++ b/gcc/testsuite/gcc.dg/cast-1.c
@@ -35,7 +35,7 @@ f (void)
   (void) sv;
   (const void) uv;
   (void *) c; /* { dg-warning "cast to pointer from integer of different size" } */
-  /* { dg-warning "cast from provenance-free integer type to pointer type will give pointer that can not be dereferenced" "" { target { aarch64_capability_any } } .-1 } */
+  /* { dg-warning "cast from provenance-free integer type to pointer type will give pointer that can not be dereferenced" "" { target { cheri_pointers_are_caps } } .-1 } */
   (void *) (char) 1;
   (char) p; /* { dg-warning "cast from pointer to integer of different size" } */
   (char) (void *) 1; /* { dg-warning "cast from pointer to integer of different size" } */
diff --git a/gcc/testsuite/gcc.dg/cast-2.c b/gcc/testsuite/gcc.dg/cast-2.c
index 736bac66419..889fa0e1f94 100644
--- a/gcc/testsuite/gcc.dg/cast-2.c
+++ b/gcc/testsuite/gcc.dg/cast-2.c
@@ -35,7 +35,7 @@ f (void)
   (void) sv;
   (const void) uv;
   (void *) c; /* { dg-warning "cast to pointer from integer of different size" } */
-  /* { dg-warning "cast from provenance-free integer type to pointer type will give pointer that can not be dereferenced" "" { target { aarch64_capability_any } } .-1 } */
+  /* { dg-warning "cast from provenance-free integer type to pointer type will give pointer that can not be dereferenced" "" { target { cheri_pointers_are_caps } } .-1 } */
   (void *) (char) 1;
   (char) p; /* { dg-warning "cast from pointer to integer of different size" } */
   (char) (void *) 1; /* { dg-warning "cast from pointer to integer of different size" } */
diff --git a/gcc/testsuite/gcc.dg/cast-3.c b/gcc/testsuite/gcc.dg/cast-3.c
index 9fb721ef19a..d6d17ee804c 100644
--- a/gcc/testsuite/gcc.dg/cast-3.c
+++ b/gcc/testsuite/gcc.dg/cast-3.c
@@ -35,7 +35,7 @@ f (void)
   (void) sv;
   (const void) uv;
   (void *) c; /* { dg-warning "cast to pointer from integer of different size" } */
-  /* { dg-warning "cast from provenance-free integer type to pointer type will give pointer that can not be dereferenced" "" { target { aarch64_capability_any } } .-1 } */
+  /* { dg-warning "cast from provenance-free integer type to pointer type will give pointer that can not be dereferenced" "" { target { cheri_pointers_are_caps } } .-1 } */
   (void *) (char) 1;
   (char) p; /* { dg-warning "cast from pointer to integer of different size" } */
   (char) (void *) 1; /* { dg-warning "cast from pointer to integer of different size" } */
diff --git a/gcc/testsuite/gcc.dg/format/cast-1.c b/gcc/testsuite/gcc.dg/format/cast-1.c
index f1cc296ddc6..bca5589a019 100644
--- a/gcc/testsuite/gcc.dg/format/cast-1.c
+++ b/gcc/testsuite/gcc.dg/format/cast-1.c
@@ -13,5 +13,5 @@ f (int x)
   printf("%s", x); /* { dg-warning "format" } */
   printf((char *)(__UINTPTR_TYPE__)"%s", x); /* { dg-warning "format" } */
   printf((char *)(char)"%s", x); /* { dg-warning "cast from pointer to integer of different size" } */
-  /* { dg-warning "cast from provenance-free integer type to pointer type will give pointer that can not be dereferenced" "" { target { aarch64_capability_any } } .-1 } */
+  /* { dg-warning "cast from provenance-free integer type to pointer type will give pointer that can not be dereferenced" "" { target { cheri_pointers_are_caps } } .-1 } */
 }
diff --git a/gcc/testsuite/gcc.dg/format/nonlit-1.c b/gcc/testsuite/gcc.dg/format/nonlit-1.c
index d5b5794d6b7..e7788e71308 100644
--- a/gcc/testsuite/gcc.dg/format/nonlit-1.c
+++ b/gcc/testsuite/gcc.dg/format/nonlit-1.c
@@ -9,6 +9,6 @@ void
 foo (char *s, size_t i)
 {
   printf ((const char *)i, i); /* { dg-warning "argument types" "non-literal" } */
-  /* { dg-warning "cast from provenance-free integer type to pointer type will give pointer that can not be dereferenced" "" { target { aarch64_capability_any } } .-1 } */
+  /* { dg-warning "cast from provenance-free integer type to pointer type will give pointer that can not be dereferenced" "" { target { cheri_pointers_are_caps } } .-1 } */
   printf (s, i); /* { dg-warning "argument types" "non-literal" } */
 }
diff --git a/gcc/testsuite/gcc.dg/format/nonlit-2.c b/gcc/testsuite/gcc.dg/format/nonlit-2.c
index 6c4f6296ca0..66e9b3da249 100644
--- a/gcc/testsuite/gcc.dg/format/nonlit-2.c
+++ b/gcc/testsuite/gcc.dg/format/nonlit-2.c
@@ -9,6 +9,6 @@ void
 foo (char *s, size_t i)
 {
   printf ((const char *)i, i); /* { dg-warning "argument types" "non-literal" } */
-  /* { dg-warning "cast from provenance-free integer type to pointer type will give pointer that can not be dereferenced" "" { target { aarch64_capability_any } } .-1 } */
+  /* { dg-warning "cast from provenance-free integer type to pointer type will give pointer that can not be dereferenced" "" { target { cheri_pointers_are_caps } } .-1 } */
   printf (s, i); /* { dg-warning "argument types" "non-literal" } */
 }
diff --git a/gcc/testsuite/gcc.dg/inline-16.c b/gcc/testsuite/gcc.dg/inline-16.c
index 5bb893c263a..c4e64aa7977 100644
--- a/gcc/testsuite/gcc.dg/inline-16.c
+++ b/gcc/testsuite/gcc.dg/inline-16.c
@@ -6,7 +6,7 @@ func1(const volatile void * base, __SIZE_TYPE__ byteOffset)
 {
   volatile __SIZE_TYPE__ *addr
     = (volatile __SIZE_TYPE__ *)((__SIZE_TYPE__)base + byteOffset);
-  /* { dg-warning "cast from provenance-free integer type to pointer type will give pointer that can not be dereferenced" "" { target { aarch64_capability_any } } .-1 } */
+  /* { dg-warning "cast from provenance-free integer type to pointer type will give pointer that can not be dereferenced" "" { target { cheri_pointers_are_caps } } .-1 } */
   return *addr;
 }
 
diff --git a/gcc/testsuite/gcc.dg/ipa/ipa-pta-13.c b/gcc/testsuite/gcc.dg/ipa/ipa-pta-13.c
index 1bb46ddfcb1..6f034800ea1 100644
--- a/gcc/testsuite/gcc.dg/ipa/ipa-pta-13.c
+++ b/gcc/testsuite/gcc.dg/ipa/ipa-pta-13.c
@@ -27,7 +27,7 @@ extern void link_error (void);
 int main()
 {
   void (*anyfn)(int *) = (void (*)(int *))(__SIZE_TYPE__)anyfn_global;
-  /* { dg-warning "cast from provenance-free integer type to pointer type will give pointer that can not be dereferenced" "" { target { aarch64_capability_any } } .-1 } */
+  /* { dg-warning "cast from provenance-free integer type to pointer type will give pointer that can not be dereferenced" "" { target { cheri_pointers_are_caps } } .-1 } */
   /* The following should cause local_address_taken to get &x
      as argument, but not local.  We shouldn't get &x added to
      arbitrary special sub-vars of local_address_taken though,
diff --git a/gcc/testsuite/gcc.dg/pr37561.c b/gcc/testsuite/gcc.dg/pr37561.c
index 35ac86300a7..0170ac37484 100644
--- a/gcc/testsuite/gcc.dg/pr37561.c
+++ b/gcc/testsuite/gcc.dg/pr37561.c
@@ -11,24 +11,24 @@ foo ()
 
   ((char *) q)++;	/* { dg-error "lvalue" } */
   /* { dg-warning "cast to pointer from integer of different size" "" { target *-*-* } .-1 } */
-  /* { dg-warning "cast from provenance-free integer type to pointer type will give pointer that can not be dereferenced" "" { target { aarch64_capability_any } } .-2 } */
+  /* { dg-warning "cast from provenance-free integer type to pointer type will give pointer that can not be dereferenced" "" { target { cheri_pointers_are_caps } } .-2 } */
 
   ((char *) p)--;	/* { dg-error "lvalue" } */
 
   ((char *) q)--;	/* { dg-error "lvalue" } */
   /* { dg-warning "cast to pointer from integer of different size" "" { target *-*-* } .-1 } */
-  /* { dg-warning "cast from provenance-free integer type to pointer type will give pointer that can not be dereferenced" "" { target { aarch64_capability_any } } .-2 } */
+  /* { dg-warning "cast from provenance-free integer type to pointer type will give pointer that can not be dereferenced" "" { target { cheri_pointers_are_caps } } .-2 } */
 
   ++(char *) p;		/* { dg-error "lvalue" } */
 
   ++(char *) q;		/* { dg-error "lvalue" } */
   /* { dg-warning "cast to pointer from integer of different size" "" { target *-*-* } .-1 } */
-  /* { dg-warning "cast from provenance-free integer type to pointer type will give pointer that can not be dereferenced" "" { target { aarch64_capability_any } } .-2 } */
+  /* { dg-warning "cast from provenance-free integer type to pointer type will give pointer that can not be dereferenced" "" { target { cheri_pointers_are_caps } } .-2 } */
 
   --(char *) p;		/* { dg-error "lvalue" } */
 
   --(char *) q;		/* { dg-error "lvalue" } */
   /* { dg-warning "cast to pointer from integer of different size" "" { target *-*-* } .-1 } */
-  /* { dg-warning "cast from provenance-free integer type to pointer type will give pointer that can not be dereferenced" "" { target { aarch64_capability_any } } .-2 } */
+  /* { dg-warning "cast from provenance-free integer type to pointer type will give pointer that can not be dereferenced" "" { target { cheri_pointers_are_caps } } .-2 } */
 }
 
diff --git a/gcc/testsuite/gcc.dg/pr49544.c b/gcc/testsuite/gcc.dg/pr49544.c
index b223834b88d..ef80c88fe17 100644
--- a/gcc/testsuite/gcc.dg/pr49544.c
+++ b/gcc/testsuite/gcc.dg/pr49544.c
@@ -19,5 +19,5 @@ long
 bar (long x, long y, long z)
 {
   return foo (x, y, (void *) (ptr_t) z);
-  /* { dg-warning "cast from provenance-free integer type to pointer type will give pointer that can not be dereferenced" "" { target { aarch64_capability_any } } .-1 } */
+  /* { dg-warning "cast from provenance-free integer type to pointer type will give pointer that can not be dereferenced" "" { target { cheri_pointers_are_caps } } .-1 } */
 }
diff --git a/gcc/testsuite/gcc.dg/pr50908.c b/gcc/testsuite/gcc.dg/pr50908.c
index 7b631693256..8903a8dfdca 100644
--- a/gcc/testsuite/gcc.dg/pr50908.c
+++ b/gcc/testsuite/gcc.dg/pr50908.c
@@ -85,7 +85,7 @@ compute_motion (from, fromvpos, fromhpos, did_motion, to, tovpos, tohpos,
 		    (struct frame
 		     *) ((long) (((win)->frame) & ~((((long) 1) << 3) -
 						    1)))))->text_cols))
-  /* { dg-warning "cast from provenance-free integer type to pointer type will give pointer that can not be dereferenced" "" { target { aarch64_capability_any } } .-3 } */
+  /* { dg-warning "cast from provenance-free integer type to pointer type will give pointer that can not be dereferenced" "" { target { cheri_pointers_are_caps } } .-3 } */
 	    {
 	      if (pos <= to)
 		{
@@ -115,7 +115,7 @@ compute_motion (from, fromvpos, fromhpos, did_motion, to, tovpos, tohpos,
 		      (struct Lisp_Vector
 		       *) ((long) ((charvec) & ~((((long) 1) << 3) - 1))))->
 		     size & ((((unsigned long) 1 << (64 - 1)) >> 1)))))
-  /* { dg-warning "cast from provenance-free integer type to pointer type will give pointer that can not be dereferenced" "" { target { aarch64_capability_any } } .-3 } */
+  /* { dg-warning "cast from provenance-free integer type to pointer type will give pointer that can not be dereferenced" "" { target { cheri_pointers_are_caps } } .-3 } */
 		{
 		  unsigned char *ptr;
 		  int bytes, width, wide_column;
@@ -140,7 +140,7 @@ compute_motion (from, fromvpos, fromhpos, did_motion, to, tovpos, tohpos,
 								   Lisp_Type)
 								  (((unsigned
 								     long) (((dp)->ascii))) & ((((long) 1) << 3) - 1))) == Lisp_Vectorlike) && (((((void) 0, (struct Lisp_Vector *) ((long) (((dp)->ascii) & ~((((long) 1) << 3) - 1))))->size & (((((unsigned long) 1 << (64 - 1)) >> 1)) | (PVEC_SUB_CHAR_TABLE)))) == (((((unsigned long) 1 << (64 - 1)) >> 1)) | (PVEC_SUB_CHAR_TABLE)))) ? ((void) 0, (struct Lisp_Sub_Char_Table *) ((long) (((dp)->ascii) & ~((((long) 1) << 3) - 1))))->contents[c] : (dp)->ascii)) : disp_char_vector ((dp), (c)))))) & ((((long) 1) << 3) - 1))) == Lisp_Vectorlike) && !(((void) 0, (struct Lisp_Vector *) ((long) (((((unsigned) (c) < 0x80) ? ((((dp)->ascii) == (Qnil)) ? (dp)->defalt : (((((enum Lisp_Type) (((unsigned long) (((dp)->ascii))) & ((((long) 1) << 3) - 1))) == Lisp_Vectorlike) && (((((void) 0, (struct Lisp_Vector *) ((long) (((dp)->ascii) & ~((((long) 1) << 3) - 1))))->size & (((((unsigned long) 1 << (64 - 1)) >> 1)) | (PVEC_SUB_CHAR_TABLE)))) == (((((unsigned long) 1 << (64 - 1)) >> 1)) | (PVEC_SUB_CHAR_TABLE)))) ? ((void) 0, (struct Lisp_Sub_Char_Table *) ((long) (((dp)->ascii) & ~((((long) 1) << 3) - 1))))->contents[c] : (dp)->ascii)) : disp_char_vector ((dp), (c)))) & ~((((long) 1) << 3) - 1))))->size & ((((unsigned long) 1 << (64 - 1)) >> 1)))))
-  /* { dg-warning "cast from provenance-free integer type to pointer type will give pointer that can not be dereferenced" "" { target { aarch64_capability_any } } .-1 } */
+  /* { dg-warning "cast from provenance-free integer type to pointer type will give pointer that can not be dereferenced" "" { target { cheri_pointers_are_caps } } .-1 } */
 			    width =
 			      ((void) 0,
 			       (struct Lisp_Vector
@@ -150,8 +150,8 @@ compute_motion (from, fromvpos, fromhpos, did_motion, to, tovpos, tohpos,
 							defalt
 							: (((((enum
 							       Lisp_Type) (((unsigned long) (((dp)->ascii))) & ((((long) 1) << 3) - 1))) == Lisp_Vectorlike) && (((((void) 0, (struct Lisp_Vector *) ((long) (((dp)->ascii) & ~((((long) 1) << 3) - 1))))->size & (((((unsigned long) 1 << (64 - 1)) >> 1)) | (PVEC_SUB_CHAR_TABLE)))) == (((((unsigned long) 1 << (64 - 1)) >> 1)) | (PVEC_SUB_CHAR_TABLE)))) ? ((void) 0, (struct Lisp_Sub_Char_Table *) ((long) (((dp)->ascii) & ~((((long) 1) << 3) - 1))))->contents[c] : (dp)->ascii)) : disp_char_vector ((dp), (c)))) & ~((((long) 1) << 3) - 1))))->size;
-  /* { dg-warning "cast from provenance-free integer type to pointer type will give pointer that can not be dereferenced" "" { target { aarch64_capability_any } } .-7 } */
-  /* { dg-warning "cast from provenance-free integer type to pointer type will give pointer that can not be dereferenced" "" { target { aarch64_capability_any } } .-2 } */
+  /* { dg-warning "cast from provenance-free integer type to pointer type will give pointer that can not be dereferenced" "" { target { cheri_pointers_are_caps } } .-7 } */
+  /* { dg-warning "cast from provenance-free integer type to pointer type will give pointer that can not be dereferenced" "" { target { cheri_pointers_are_caps } } .-2 } */
 			  else
 			    width =
 			      (((unsigned) (c) < 0x80) ? (c <
diff --git a/gcc/testsuite/gcc.dg/pr52549.c b/gcc/testsuite/gcc.dg/pr52549.c
index 39c4050588a..93601c50068 100644
--- a/gcc/testsuite/gcc.dg/pr52549.c
+++ b/gcc/testsuite/gcc.dg/pr52549.c
@@ -15,5 +15,5 @@ __extension__ _mark (long long obj, int i, char *a)
 #endif
 {
   (char *)&(((valtype)(obj)) [i]) - a;
-  /* { dg-warning "cast from provenance-free integer type to pointer type will give pointer that can not be dereferenced" "" { target { aarch64_capability_any } } .-1 } */
+  /* { dg-warning "cast from provenance-free integer type to pointer type will give pointer that can not be dereferenced" "" { target { cheri_pointers_are_caps } } .-1 } */
 }
diff --git a/gcc/testsuite/gcc.dg/pr64536.c b/gcc/testsuite/gcc.dg/pr64536.c
index 91d98278e35..9bff5e3ce62 100644
--- a/gcc/testsuite/gcc.dg/pr64536.c
+++ b/gcc/testsuite/gcc.dg/pr64536.c
@@ -41,7 +41,7 @@ bar (int x)
 	    }
 	  else
 	    i = (long *) (h->q = *f);
-	    /* { dg-warning "cast from provenance-free integer type to pointer type will give pointer that can not be dereferenced" "" { target { aarch64_capability_any } } .-1 } */
+	    /* { dg-warning "cast from provenance-free integer type to pointer type will give pointer that can not be dereferenced" "" { target { cheri_pointers_are_caps } } .-1 } */
 	  *c++ = (long) f;
 	  e += 6;
 	}
@@ -56,7 +56,7 @@ bar (int x)
 	    }
 	  else
 	    i = (long *) (h->q = *f);
-	    /* { dg-warning "cast from provenance-free integer type to pointer type will give pointer that can not be dereferenced" "" { target { aarch64_capability_any } } .-1 } */
+	    /* { dg-warning "cast from provenance-free integer type to pointer type will give pointer that can not be dereferenced" "" { target { cheri_pointers_are_caps } } .-1 } */
 	  *c++ = (long) f;
 	  e += 6;
 	}
diff --git a/gcc/testsuite/gcc.dg/pr65658.c b/gcc/testsuite/gcc.dg/pr65658.c
index 1e0dab23cf7..2eed2b4b8c8 100644
--- a/gcc/testsuite/gcc.dg/pr65658.c
+++ b/gcc/testsuite/gcc.dg/pr65658.c
@@ -77,7 +77,7 @@ setup (void)
   if (fn4 (101))
     return 1;
   if (undefinit2 ((void *) problem.l1, problem.l3 * 4))  /* { dg-bogus "problem.l3" "uninitialized variable warning" } */ 
-  /* { dg-warning "cast from provenance-free integer type to pointer type will give pointer that can not be dereferenced" "" { target { aarch64_capability_any } } .-1 } */
+  /* { dg-warning "cast from provenance-free integer type to pointer type will give pointer that can not be dereferenced" "" { target { cheri_pointers_are_caps } } .-1 } */
     return 1;
 }
 
diff --git a/gcc/testsuite/gcc.dg/pr70920-3.c b/gcc/testsuite/gcc.dg/pr70920-3.c
index 8b24cbc734f..696f0c13d58 100644
--- a/gcc/testsuite/gcc.dg/pr70920-3.c
+++ b/gcc/testsuite/gcc.dg/pr70920-3.c
@@ -9,7 +9,7 @@ void f2();
 void
 foo (int a)
 {
-  if ((int *) a == 0)
+  if ((int *) a == 0) /* { dg-warning "cast from provenance-free integer type to pointer type" "" { target { cheri_pointers_are_caps } } } */
     {
       f1 ();
       if (a)
diff --git a/gcc/testsuite/gcc.dg/pr94188.c b/gcc/testsuite/gcc.dg/pr94188.c
index 291a0a60b7e..7d691a8dbb0 100644
--- a/gcc/testsuite/gcc.dg/pr94188.c
+++ b/gcc/testsuite/gcc.dg/pr94188.c
@@ -7,5 +7,5 @@ struct dm_tree_link {
 void fn1(void *p)
 {
   0 ? ((struct dm_tree_link *)((char *)p - (char *)&((struct dm_tree_link *)0)->list))->node : 0;
-  /* { dg-warning "cast from provenance-free integer type to pointer type will give pointer that can not be dereferenced" "" { target { aarch64_capability_any } } .-1 } */
+  /* { dg-warning "cast from provenance-free integer type to pointer type will give pointer that can not be dereferenced" "" { target { cheri_pointers_are_caps } } .-1 } */
 }
diff --git a/gcc/testsuite/gcc.dg/pr94436.c b/gcc/testsuite/gcc.dg/pr94436.c
index dfad5621dac..e6c1e72fafe 100644
--- a/gcc/testsuite/gcc.dg/pr94436.c
+++ b/gcc/testsuite/gcc.dg/pr94436.c
@@ -10,5 +10,5 @@ bar (void)
 {
   int s = 0;
   return foo ((struct S *) ((char *) &s - (char *) &((struct S *) 0)->s));	/* { dg-bogus "from incompatible pointer type" } */
-  /* { dg-warning "cast from provenance-free integer type to pointer type will give pointer that can not be dereferenced" "" { target { aarch64_capability_any } } .-1 } */
+  /* { dg-warning "cast from provenance-free integer type to pointer type will give pointer that can not be dereferenced" "" { target { cheri_pointers_are_caps } } .-1 } */
 }
diff --git a/gcc/testsuite/gcc.dg/pr94600-1.c b/gcc/testsuite/gcc.dg/pr94600-1.c
index a6eb2323131..ce77f8877f7 100644
--- a/gcc/testsuite/gcc.dg/pr94600-1.c
+++ b/gcc/testsuite/gcc.dg/pr94600-1.c
@@ -28,7 +28,7 @@ foo(void)
   __SIZE_TYPE__ base = 0x000a0000;
   for (i = 0; i < (sizeof (a0) / sizeof ((a0)[0])); i++) {
     *(volatile t0 *) (base + 44 + i * 4) = a0[i];
-  /* { dg-warning "cast from provenance-free integer type to pointer type will give pointer that can not be dereferenced" "" { target { aarch64_capability_any } } .-1 } */
+  /* { dg-warning "cast from provenance-free integer type to pointer type will give pointer that can not be dereferenced" "" { target { cheri_pointers_are_caps } } .-1 } */
   }
 }
 
diff --git a/gcc/testsuite/gcc.dg/pr94600-2.c b/gcc/testsuite/gcc.dg/pr94600-2.c
index 0905a67a70b..efd77418b08 100644
--- a/gcc/testsuite/gcc.dg/pr94600-2.c
+++ b/gcc/testsuite/gcc.dg/pr94600-2.c
@@ -28,12 +28,12 @@ bar(void)
   *(volatile t0 *) ((base) + 44 + (3) * 4) = a03;
   *(volatile t0 *) ((base) + 44 + (4) * 4) = a04;
   *(volatile t0 *) ((base) + 44 + (5) * 4) = a05;
-  /* { dg-warning "cast from provenance-free integer type to pointer type will give pointer that can not be dereferenced" "" { target { aarch64_capability_any } } .-6 } */
-  /* { dg-warning "cast from provenance-free integer type to pointer type will give pointer that can not be dereferenced" "" { target { aarch64_capability_any } } .-6 } */
-  /* { dg-warning "cast from provenance-free integer type to pointer type will give pointer that can not be dereferenced" "" { target { aarch64_capability_any } } .-6 } */
-  /* { dg-warning "cast from provenance-free integer type to pointer type will give pointer that can not be dereferenced" "" { target { aarch64_capability_any } } .-6 } */
-  /* { dg-warning "cast from provenance-free integer type to pointer type will give pointer that can not be dereferenced" "" { target { aarch64_capability_any } } .-6 } */
-  /* { dg-warning "cast from provenance-free integer type to pointer type will give pointer that can not be dereferenced" "" { target { aarch64_capability_any } } .-6 } */
+  /* { dg-warning "cast from provenance-free integer type to pointer type will give pointer that can not be dereferenced" "" { target { cheri_pointers_are_caps } } .-6 } */
+  /* { dg-warning "cast from provenance-free integer type to pointer type will give pointer that can not be dereferenced" "" { target { cheri_pointers_are_caps } } .-6 } */
+  /* { dg-warning "cast from provenance-free integer type to pointer type will give pointer that can not be dereferenced" "" { target { cheri_pointers_are_caps } } .-6 } */
+  /* { dg-warning "cast from provenance-free integer type to pointer type will give pointer that can not be dereferenced" "" { target { cheri_pointers_are_caps } } .-6 } */
+  /* { dg-warning "cast from provenance-free integer type to pointer type will give pointer that can not be dereferenced" "" { target { cheri_pointers_are_caps } } .-6 } */
+  /* { dg-warning "cast from provenance-free integer type to pointer type will give pointer that can not be dereferenced" "" { target { cheri_pointers_are_caps } } .-6 } */
 }
 
 /* { dg-final { scan-rtl-dump-times {\(mem/v} 6 "final" } } */
diff --git a/gcc/testsuite/gcc.dg/pr94600-3.c b/gcc/testsuite/gcc.dg/pr94600-3.c
index ba9f18ec14c..bea920b5d69 100644
--- a/gcc/testsuite/gcc.dg/pr94600-3.c
+++ b/gcc/testsuite/gcc.dg/pr94600-3.c
@@ -27,7 +27,7 @@ foo(void)
   __SIZE_TYPE__ base = 0x000a0000;
   for (i = 0; i < (sizeof (a0) / sizeof ((a0)[0])); i++) {
     *(volatile t0 *) (base + 44) = a0[i];
-  /* { dg-warning "cast from provenance-free integer type to pointer type will give pointer that can not be dereferenced" "" { target { aarch64_capability_any } } .-1 } */
+  /* { dg-warning "cast from provenance-free integer type to pointer type will give pointer that can not be dereferenced" "" { target { cheri_pointers_are_caps } } .-1 } */
   }
 }
 
diff --git a/gcc/testsuite/gcc.dg/pr94600-4.c b/gcc/testsuite/gcc.dg/pr94600-4.c
index 22662d6a8de..fbcc28fa2ae 100644
--- a/gcc/testsuite/gcc.dg/pr94600-4.c
+++ b/gcc/testsuite/gcc.dg/pr94600-4.c
@@ -28,12 +28,12 @@ bar(void)
   *(volatile t0 *) ((base) + 44) = a03;
   *(volatile t0 *) ((base) + 44) = a04;
   *(volatile t0 *) ((base) + 44) = a05;
-  /* { dg-warning "cast from provenance-free integer type to pointer type will give pointer that can not be dereferenced" "" { target { aarch64_capability_any } } .-6 } */
-  /* { dg-warning "cast from provenance-free integer type to pointer type will give pointer that can not be dereferenced" "" { target { aarch64_capability_any } } .-6 } */
-  /* { dg-warning "cast from provenance-free integer type to pointer type will give pointer that can not be dereferenced" "" { target { aarch64_capability_any } } .-6 } */
-  /* { dg-warning "cast from provenance-free integer type to pointer type will give pointer that can not be dereferenced" "" { target { aarch64_capability_any } } .-6 } */
-  /* { dg-warning "cast from provenance-free integer type to pointer type will give pointer that can not be dereferenced" "" { target { aarch64_capability_any } } .-6 } */
-  /* { dg-warning "cast from provenance-free integer type to pointer type will give pointer that can not be dereferenced" "" { target { aarch64_capability_any } } .-6 } */
+  /* { dg-warning "cast from provenance-free integer type to pointer type will give pointer that can not be dereferenced" "" { target { cheri_pointers_are_caps } } .-6 } */
+  /* { dg-warning "cast from provenance-free integer type to pointer type will give pointer that can not be dereferenced" "" { target { cheri_pointers_are_caps } } .-6 } */
+  /* { dg-warning "cast from provenance-free integer type to pointer type will give pointer that can not be dereferenced" "" { target { cheri_pointers_are_caps } } .-6 } */
+  /* { dg-warning "cast from provenance-free integer type to pointer type will give pointer that can not be dereferenced" "" { target { cheri_pointers_are_caps } } .-6 } */
+  /* { dg-warning "cast from provenance-free integer type to pointer type will give pointer that can not be dereferenced" "" { target { cheri_pointers_are_caps } } .-6 } */
+  /* { dg-warning "cast from provenance-free integer type to pointer type will give pointer that can not be dereferenced" "" { target { cheri_pointers_are_caps } } .-6 } */
 }
 
 /* { dg-final { scan-rtl-dump-times {\(mem/v} 6 "final" } } */
diff --git a/gcc/testsuite/gcc.dg/sms-5.c b/gcc/testsuite/gcc.dg/sms-5.c
index 06c10b4dda1..e4722595d00 100644
--- a/gcc/testsuite/gcc.dg/sms-5.c
+++ b/gcc/testsuite/gcc.dg/sms-5.c
@@ -36,7 +36,7 @@ int main ()
 
   /* Pretend that's good enough to start address arithmetic.  */
   p = (void *)start;
-  /* { dg-warning "cast from provenance-free integer type to pointer type will give pointer that can not be dereferenced" "" { target { aarch64_capability_any } } .-1 } */
+  /* { dg-warning "cast from provenance-free integer type to pointer type will give pointer that can not be dereferenced" "" { target { cheri_pointers_are_caps } } .-1 } */
 
   /* Verify that GIV replacement computes the correct results.  */
   q[39] = 0;
diff --git a/gcc/testsuite/gcc.dg/struct-ret-3.c b/gcc/testsuite/gcc.dg/struct-ret-3.c
index 533ff261308..b45bb141ea1 100644
--- a/gcc/testsuite/gcc.dg/struct-ret-3.c
+++ b/gcc/testsuite/gcc.dg/struct-ret-3.c
@@ -78,7 +78,7 @@ int main(void)
    char buf[sizeof(struct stuff)+CHUNK_SIZE];
    struct stuff *u
      = (struct stuff *)ossAlignX((unsigned long)&buf[0], CHUNK_SIZE);
-  /* { dg-warning "cast from provenance-free integer type to pointer type will give pointer that can not be dereferenced" "" { target { aarch64_capability_any } } .-1 } */
+  /* { dg-warning "cast from provenance-free integer type to pointer type will give pointer that can not be dereferenced" "" { target { cheri_pointers_are_caps } } .-1 } */
 
    /* This test assumes system memory page
       size of CHUNK_SIZE bytes or less.  */
diff --git a/gcc/testsuite/gcc.dg/torture/20200311-1.c b/gcc/testsuite/gcc.dg/torture/20200311-1.c
index faa4d5289a8..d0639b358cf 100644
--- a/gcc/testsuite/gcc.dg/torture/20200311-1.c
+++ b/gcc/testsuite/gcc.dg/torture/20200311-1.c
@@ -22,6 +22,6 @@ int main(int argc, char *argv[])
        pointer conversion to pointer offsetting.  */
     o = ((struct obj *)((const char *)(o->l.n)
 			- (const char *)&((struct obj *)0)->l));
-  /* { dg-warning "cast from provenance-free integer type to pointer type will give pointer that can not be dereferenced" "" { target { aarch64_capability_any } } .-2 } */
+  /* { dg-warning "cast from provenance-free integer type to pointer type will give pointer that can not be dereferenced" "" { target { cheri_pointers_are_caps } } .-2 } */
   return 0;
 }
diff --git a/gcc/testsuite/gcc.dg/torture/pr28814.c b/gcc/testsuite/gcc.dg/torture/pr28814.c
index ac011fd464c..e9c99acc0ab 100644
--- a/gcc/testsuite/gcc.dg/torture/pr28814.c
+++ b/gcc/testsuite/gcc.dg/torture/pr28814.c
@@ -13,7 +13,7 @@ f9887 (struct w49 a23040)
 {
   unsigned long r9887;
   if (((struct structure_type24753 *) (r9887 - 1)) == ((void *) 0))
-  /* { dg-warning "cast from provenance-free integer type to pointer type will give pointer that can not be dereferenced" "" { target { aarch64_capability_any } } .-1 } */
+  /* { dg-warning "cast from provenance-free integer type to pointer type will give pointer that can not be dereferenced" "" { target { cheri_pointers_are_caps } } .-1 } */
     {
       backtrace ("stalin.sc", 7222, 248274);
     }
diff --git a/gcc/testsuite/gcc.dg/torture/pr29584.c b/gcc/testsuite/gcc.dg/torture/pr29584.c
index da683f29805..33b21582339 100644
--- a/gcc/testsuite/gcc.dg/torture/pr29584.c
+++ b/gcc/testsuite/gcc.dg/torture/pr29584.c
@@ -24,6 +24,6 @@ bar (void)
 	  s = foo1 ();
 	}
       foo3 ((void *) (0x8000000UL + i * 0x400), s);
-      /* { dg-warning "cast from provenance-free integer type to pointer type will give pointer that can not be dereferenced" "" { target { aarch64_capability_any } } .-1 } */
+      /* { dg-warning "cast from provenance-free integer type to pointer type will give pointer that can not be dereferenced" "" { target { cheri_pointers_are_caps } } .-1 } */
     }
 }
diff --git a/gcc/testsuite/gcc.dg/torture/pr57864.c b/gcc/testsuite/gcc.dg/torture/pr57864.c
index 66a6eb2789e..fee9847a874 100644
--- a/gcc/testsuite/gcc.dg/torture/pr57864.c
+++ b/gcc/testsuite/gcc.dg/torture/pr57864.c
@@ -16,13 +16,13 @@ static void fn1(union U *p1, int p2, _Bool p3)
 
     if (p2 == 0)
 	a = ((union U*)((__SIZE_TYPE__)p1 & ~1))->val;
-       /* { dg-warning "cast from provenance-free integer type to pointer type will give pointer that can not be dereferenced" "" { target { aarch64_capability_any } } .-1 } */
+       /* { dg-warning "cast from provenance-free integer type to pointer type will give pointer that can not be dereferenced" "" { target { cheri_pointers_are_caps } } .-1 } */
 
     if (b) {
 	e = p1;
     } else if (c) {
 	e = ((union U*)((__SIZE_TYPE__)p1 & ~1))->ptr;
-       /* { dg-warning "cast from provenance-free integer type to pointer type will give pointer that can not be dereferenced" "" { target { aarch64_capability_any } } .-1 } */
+       /* { dg-warning "cast from provenance-free integer type to pointer type will give pointer that can not be dereferenced" "" { target { cheri_pointers_are_caps } } .-1 } */
 	d = e;
     } else {
 	e = 0;
diff --git a/gcc/testsuite/gcc.dg/torture/pr61095.c b/gcc/testsuite/gcc.dg/torture/pr61095.c
index 09c02052169..844d51399f1 100644
--- a/gcc/testsuite/gcc.dg/torture/pr61095.c
+++ b/gcc/testsuite/gcc.dg/torture/pr61095.c
@@ -6,7 +6,7 @@ extern void __attribute__ ((noreturn)) abort (void);
 int __attribute__ ((noinline, noclone))
 foo (unsigned long addr) {
     unsigned long *p = (unsigned long*)((addr & 0xffff83fffffffff8UL) * 4);
-    /* { dg-warning "cast from provenance-free integer type to pointer type will give pointer that can not be dereferenced" "" { target { aarch64_capability_any } } .-1 } */
+    /* { dg-warning "cast from provenance-free integer type to pointer type will give pointer that can not be dereferenced" "" { target { cheri_pointers_are_caps } } .-1 } */
     unsigned long xxx = (unsigned long)(p + 1);
     return xxx >= 0x3c000000000UL;
 }
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/strlen-1.c b/gcc/testsuite/gcc.dg/tree-ssa/strlen-1.c
index 832e1b7e2f5..bbe5694cdc6 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/strlen-1.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/strlen-1.c
@@ -5,7 +5,7 @@ static inline void wreg(unsigned char val, unsigned long addr) __attribute__((al
 static inline void wreg(unsigned char val, unsigned long addr)
 {
    *((volatile unsigned char *) (__SIZE_TYPE__) (base + addr)) = val;
-   /* { dg-warning "cast from provenance-free integer type to pointer type will give pointer that can not be dereferenced" "" { target { aarch64_capability_any } } .-1 } */
+   /* { dg-warning "cast from provenance-free integer type to pointer type will give pointer that can not be dereferenced" "" { target { cheri_pointers_are_caps } } .-1 } */
 }
 void wreg_twice(void)
 {
diff --git a/gcc/testsuite/gcc.dg/vect/pr32230.c b/gcc/testsuite/gcc.dg/vect/pr32230.c
index 4b4b9a723e3..5c3b0bd5142 100644
--- a/gcc/testsuite/gcc.dg/vect/pr32230.c
+++ b/gcc/testsuite/gcc.dg/vect/pr32230.c
@@ -17,7 +17,7 @@ const_f (filter_buffer_t *buf)
 
   for (i = 0; i < 10; i++)
     ((float*) (&((sbuf_header_t *) (__PTRDIFF_TYPE__)((buf) == (filter_buffer_t *)&(buf)->buf[0]))->buf[0]))[i] = val;
-    /* { dg-warning "cast from provenance-free integer type to pointer type will give pointer that can not be dereferenced" "" { target { aarch64_capability_any } } .-1 } */
+    /* { dg-warning "cast from provenance-free integer type to pointer type will give pointer that can not be dereferenced" "" { target { cheri_pointers_are_caps } } .-1 } */
 }
 
 
diff --git a/gcc/testsuite/gcc.dg/vect/pr33833.c b/gcc/testsuite/gcc.dg/vect/pr33833.c
index 983bf907cff..21c222a62a1 100644
--- a/gcc/testsuite/gcc.dg/vect/pr33833.c
+++ b/gcc/testsuite/gcc.dg/vect/pr33833.c
@@ -24,7 +24,7 @@ void sched_init (uintptr_t __ptr)
   struct prio_array *array;
   struct rq *rq;
   rq = (&(*( { (typeof (&per_cpu__runqueues)) (__ptr); } )));
-   /* { dg-warning "cast from provenance-free integer type to pointer type will give pointer that can not be dereferenced" "" { target { aarch64_capability_any } } .-1 } */
+   /* { dg-warning "cast from provenance-free integer type to pointer type will give pointer that can not be dereferenced" "" { target { cheri_pointers_are_caps } } .-1 } */
   for (j = 0; j < 2; j++)
   {
     array = rq->arrays + j;
diff --git a/gcc/testsuite/gcc.dg/vla-11.c b/gcc/testsuite/gcc.dg/vla-11.c
index cefdd08e9eb..1fea118e709 100644
--- a/gcc/testsuite/gcc.dg/vla-11.c
+++ b/gcc/testsuite/gcc.dg/vla-11.c
@@ -8,6 +8,6 @@
 
 void foo11a(int x[sizeof(int *(*)[*])]);	/* { dg-warning "not in a declaration" } */
 void foo11b(__SIZE_TYPE__ x, int y[(__UINTPTR_TYPE__)(int (*)[*])x]);	/* { dg-warning "not in a declaration" } */
-/* { dg-warning "cast from provenance-free integer type to pointer type will give pointer that can not be dereferenced" "" { target { aarch64_capability_any } } .-1 } */
+/* { dg-warning "cast from provenance-free integer type to pointer type will give pointer that can not be dereferenced" "" { target { cheri_pointers_are_caps } } .-1 } */
 void foo11c(struct s { int (*x)[*]; } *y);	/* { dg-error "a member of a structure or union cannot have a variably modified type" "variably modified" } */
 /* { dg-warning "'struct s' declared inside parameter list" "struct decl" { target *-*-* } .-1 } */
diff --git a/gcc/testsuite/gcc.dg/vla-9.c b/gcc/testsuite/gcc.dg/vla-9.c
index ca1a5a941dc..436c536adf7 100644
--- a/gcc/testsuite/gcc.dg/vla-9.c
+++ b/gcc/testsuite/gcc.dg/vla-9.c
@@ -6,6 +6,6 @@ void f(__SIZE_TYPE__ d)
 {
   typedef int t[d];
   t *g = (__typeof (g)) d;
-  /* { dg-warning "cast from provenance-free integer type to pointer type will give pointer that can not be dereferenced" "" { target { aarch64_capability_any } } .-1 } */
+  /* { dg-warning "cast from provenance-free integer type to pointer type will give pointer that can not be dereferenced" "" { target { cheri_pointers_are_caps } } .-1 } */
   (void) g;
 }
diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp
index d44ebe15559..4653e3a1e4d 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -3567,6 +3567,19 @@ proc check_effective_target_aarch64_capability_any { } {
   }]
 }
 
+proc check_effective_target_cheri_pointers_are_caps { } {
+  # True for pure-capability CHERI as well as AArch64 fake-capability
+  # mode.
+  if { ![istarget aarch64*-*-*] } {
+      return 0
+  }
+  return [check_no_compiler_messages cheri_pointers_are_caps assembly {
+  #if !defined (__GCC_ARM_CAPABILITY_ANY) || (defined(__CHERI__) && !defined(__CHERI_PURE_CAPABILITY__))
+  #error foo
+  #endif
+  }]
+}
+
 proc check_effective_target_cheri_capability_pure { } {
   # For now this is allowed only for AArch64. The definition of this may need
   # to be expanded if other targets add support for CHERI capabilities.

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-11-01 11:01 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-01 11:01 [gcc(refs/vendors/ARM/heads/morello)] testsuite: Fixes for -Wcheri-capability-misuse Alex Coplan

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).