public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/vendors/ARM/heads/morello)] morello testsuite: Fixes for hybrid
@ 2022-11-14 13:24 Alex Coplan
  0 siblings, 0 replies; 2+ messages in thread
From: Alex Coplan @ 2022-11-14 13:24 UTC (permalink / raw)
  To: gcc-cvs

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

commit d8b6037e5336e1990413229358884dada7eadfc5
Author: Alex Coplan <alex.coplan@arm.com>
Date:   Tue Nov 8 13:14:11 2022 +0000

    morello testsuite: Fixes for hybrid
    
    cast_int2ptr_1.c: add __capability annotations so that the test also
    works on hybrid, disable one dg-error check that is expected not to
    trigger an error on hybrid.
    
    const-null-var-location.c: disable check for const_null if compiling for
    hybrid.
    
    predefines.c: __INTPTR_TYPE__ is only expected to be __intcap on
    purecap, so only check this on purecap.
    
    union-modes.c: disable scan-rtl-* on hybrid since these checks only make
    sense if pointers are capabilities.

Diff:
---
 .../gcc.target/aarch64/morello/cast_int2ptr_1.c        | 18 +++++++++---------
 .../aarch64/morello/const-null-var-location.c          |  2 +-
 gcc/testsuite/gcc.target/aarch64/morello/predefines.c  |  6 ++++++
 gcc/testsuite/gcc.target/aarch64/morello/union-modes.c |  4 ++--
 4 files changed, 18 insertions(+), 12 deletions(-)

diff --git a/gcc/testsuite/gcc.target/aarch64/morello/cast_int2ptr_1.c b/gcc/testsuite/gcc.target/aarch64/morello/cast_int2ptr_1.c
index 62cd04e76be..585e7ec39b4 100644
--- a/gcc/testsuite/gcc.target/aarch64/morello/cast_int2ptr_1.c
+++ b/gcc/testsuite/gcc.target/aarch64/morello/cast_int2ptr_1.c
@@ -2,40 +2,40 @@
 
 /* Conditional expressions.  */
 
-int *test_cond_1 (int *a, int b)
+int * __capability test_cond_1 (int * __capability a, int b)
 {
   return a ? b : a; /* { dg-warning {type mismatch} } */
 }
 
-int *test_cond_2 (int a, int *b)
+int * __capability test_cond_2 (int a, int * __capability b)
 {
   return a ? b : a; /* { dg-warning {type mismatch} } */
 }
 
-int *test_cond_3 (int *a)
+int * __capability test_cond_3 (int * __capability a)
 {
   return a ? 0 : a; /* No warning for null pointer constant.  */
 }
 
-int *test_cond_4 (int *a)
+int * __capability test_cond_4 (int * __capability a)
 {
   return a ? a : 0; /* Likewise.  */
 }
 
 /* Assignment.  */
 
-int *test_assign_1 ()
+int * __capability test_assign_1 ()
 {
   return 1; /* { dg-error {incompatible result} } */
 }
 
-int *test_assign_2 ()
+int * __capability test_assign_2 ()
 {
-  int *b = 1; /* { dg-error {incompatible type} } */
+  int * __capability b = 1; /* { dg-error {incompatible type} } */
   return b;
 }
 
-int *test_assign_3 (int *a)
+int * __capability test_assign_3 (int * __capability a)
 {
   a = 1; /* { dg-error {incompatible type} } */
   return a;
@@ -50,5 +50,5 @@ void test_assign_4 ()
 
 void test_goto_1 (int i)
 {
-  goto *i; /* { dg-error {parameter of incompatible capability type} } */
+  goto *i; /* { dg-error {parameter of incompatible capability type} "" {target {! cheri_capability_hybrid}} } */
 }
diff --git a/gcc/testsuite/gcc.target/aarch64/morello/const-null-var-location.c b/gcc/testsuite/gcc.target/aarch64/morello/const-null-var-location.c
index 10725a8b559..776a9c2510d 100644
--- a/gcc/testsuite/gcc.target/aarch64/morello/const-null-var-location.c
+++ b/gcc/testsuite/gcc.target/aarch64/morello/const-null-var-location.c
@@ -55,4 +55,4 @@ tryagain:
  return (ret);
 }
 
-/* { dg-final { scan-rtl-dump {\(var_location [a-zA-Z_]* \(const_null:CADI\)\)} {vartrack} } } */
+/* { dg-final { scan-rtl-dump {\(var_location [a-zA-Z_]* \(const_null:CADI\)\)} {vartrack} {target {! cheri_capability_hybrid}} } } */
diff --git a/gcc/testsuite/gcc.target/aarch64/morello/predefines.c b/gcc/testsuite/gcc.target/aarch64/morello/predefines.c
index d7e2b667121..14c3f83a850 100644
--- a/gcc/testsuite/gcc.target/aarch64/morello/predefines.c
+++ b/gcc/testsuite/gcc.target/aarch64/morello/predefines.c
@@ -1,5 +1,6 @@
 /* { dg-do run { target cheri_capability_any } } */
 
+#ifdef __CHERI_PURE_CAPABILITY__
 /* Declare twice to ensure that the types are the same (error otherwise).  */
 __INTPTR_TYPE__ x(int);
 __intcap x(int);
@@ -7,6 +8,7 @@ __intcap x(int);
 /* Declare twice to ensure that the types are the same (error otherwise).  */
 __UINTPTR_TYPE__ y(int);
 unsigned __intcap y(int);
+#endif
 
 /* Declare twice to ensure that the types are the same (error otherwise).  */
 __PTRADDR_TYPE__ z(int);
@@ -65,5 +67,9 @@ int main()
 	assert (__CHERI_CAP_PERMISSION_PERMIT_EXECUTE__ == 32768);
 	assert (__CHERI_CAP_PERMISSION_PERMIT_STORE__ == 65536);
 	assert (__CHERI_CAP_PERMISSION_PERMIT_LOAD__ == 131072);
+#ifdef __CHERI_PURE_CAPABILITY__
 	return wrapper(__INTPTR_TYPE__);
+#else
+	return 0;
+#endif
 }
diff --git a/gcc/testsuite/gcc.target/aarch64/morello/union-modes.c b/gcc/testsuite/gcc.target/aarch64/morello/union-modes.c
index cb3bdc23051..e8e669b6c3a 100644
--- a/gcc/testsuite/gcc.target/aarch64/morello/union-modes.c
+++ b/gcc/testsuite/gcc.target/aarch64/morello/union-modes.c
@@ -13,5 +13,5 @@ union a g() {
 	return u;
 }
 
-/* { dg-final { scan-rtl-dump-not {reg:DI[^\n]*<retval>} "expand" } } */
-/* { dg-final { scan-rtl-dump {reg:CADI[^\n]*<retval>} "expand" } } */
+/* { dg-final { scan-rtl-dump-not {reg:DI[^\n]*<retval>} "expand" {target {! cheri_capability_hybrid}} } } */
+/* { dg-final { scan-rtl-dump {reg:CADI[^\n]*<retval>} "expand" {target {! cheri_capability_hybrid}} } } */

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

* [gcc(refs/vendors/ARM/heads/morello)] morello testsuite: Fixes for hybrid
@ 2022-11-22 12:42 Stam Markianos-Wright
  0 siblings, 0 replies; 2+ messages in thread
From: Stam Markianos-Wright @ 2022-11-22 12:42 UTC (permalink / raw)
  To: gcc-cvs

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

commit d8b6037e5336e1990413229358884dada7eadfc5
Author: Alex Coplan <alex.coplan@arm.com>
Date:   Tue Nov 8 13:14:11 2022 +0000

    morello testsuite: Fixes for hybrid
    
    cast_int2ptr_1.c: add __capability annotations so that the test also
    works on hybrid, disable one dg-error check that is expected not to
    trigger an error on hybrid.
    
    const-null-var-location.c: disable check for const_null if compiling for
    hybrid.
    
    predefines.c: __INTPTR_TYPE__ is only expected to be __intcap on
    purecap, so only check this on purecap.
    
    union-modes.c: disable scan-rtl-* on hybrid since these checks only make
    sense if pointers are capabilities.

Diff:
---
 .../gcc.target/aarch64/morello/cast_int2ptr_1.c        | 18 +++++++++---------
 .../aarch64/morello/const-null-var-location.c          |  2 +-
 gcc/testsuite/gcc.target/aarch64/morello/predefines.c  |  6 ++++++
 gcc/testsuite/gcc.target/aarch64/morello/union-modes.c |  4 ++--
 4 files changed, 18 insertions(+), 12 deletions(-)

diff --git a/gcc/testsuite/gcc.target/aarch64/morello/cast_int2ptr_1.c b/gcc/testsuite/gcc.target/aarch64/morello/cast_int2ptr_1.c
index 62cd04e76be..585e7ec39b4 100644
--- a/gcc/testsuite/gcc.target/aarch64/morello/cast_int2ptr_1.c
+++ b/gcc/testsuite/gcc.target/aarch64/morello/cast_int2ptr_1.c
@@ -2,40 +2,40 @@
 
 /* Conditional expressions.  */
 
-int *test_cond_1 (int *a, int b)
+int * __capability test_cond_1 (int * __capability a, int b)
 {
   return a ? b : a; /* { dg-warning {type mismatch} } */
 }
 
-int *test_cond_2 (int a, int *b)
+int * __capability test_cond_2 (int a, int * __capability b)
 {
   return a ? b : a; /* { dg-warning {type mismatch} } */
 }
 
-int *test_cond_3 (int *a)
+int * __capability test_cond_3 (int * __capability a)
 {
   return a ? 0 : a; /* No warning for null pointer constant.  */
 }
 
-int *test_cond_4 (int *a)
+int * __capability test_cond_4 (int * __capability a)
 {
   return a ? a : 0; /* Likewise.  */
 }
 
 /* Assignment.  */
 
-int *test_assign_1 ()
+int * __capability test_assign_1 ()
 {
   return 1; /* { dg-error {incompatible result} } */
 }
 
-int *test_assign_2 ()
+int * __capability test_assign_2 ()
 {
-  int *b = 1; /* { dg-error {incompatible type} } */
+  int * __capability b = 1; /* { dg-error {incompatible type} } */
   return b;
 }
 
-int *test_assign_3 (int *a)
+int * __capability test_assign_3 (int * __capability a)
 {
   a = 1; /* { dg-error {incompatible type} } */
   return a;
@@ -50,5 +50,5 @@ void test_assign_4 ()
 
 void test_goto_1 (int i)
 {
-  goto *i; /* { dg-error {parameter of incompatible capability type} } */
+  goto *i; /* { dg-error {parameter of incompatible capability type} "" {target {! cheri_capability_hybrid}} } */
 }
diff --git a/gcc/testsuite/gcc.target/aarch64/morello/const-null-var-location.c b/gcc/testsuite/gcc.target/aarch64/morello/const-null-var-location.c
index 10725a8b559..776a9c2510d 100644
--- a/gcc/testsuite/gcc.target/aarch64/morello/const-null-var-location.c
+++ b/gcc/testsuite/gcc.target/aarch64/morello/const-null-var-location.c
@@ -55,4 +55,4 @@ tryagain:
  return (ret);
 }
 
-/* { dg-final { scan-rtl-dump {\(var_location [a-zA-Z_]* \(const_null:CADI\)\)} {vartrack} } } */
+/* { dg-final { scan-rtl-dump {\(var_location [a-zA-Z_]* \(const_null:CADI\)\)} {vartrack} {target {! cheri_capability_hybrid}} } } */
diff --git a/gcc/testsuite/gcc.target/aarch64/morello/predefines.c b/gcc/testsuite/gcc.target/aarch64/morello/predefines.c
index d7e2b667121..14c3f83a850 100644
--- a/gcc/testsuite/gcc.target/aarch64/morello/predefines.c
+++ b/gcc/testsuite/gcc.target/aarch64/morello/predefines.c
@@ -1,5 +1,6 @@
 /* { dg-do run { target cheri_capability_any } } */
 
+#ifdef __CHERI_PURE_CAPABILITY__
 /* Declare twice to ensure that the types are the same (error otherwise).  */
 __INTPTR_TYPE__ x(int);
 __intcap x(int);
@@ -7,6 +8,7 @@ __intcap x(int);
 /* Declare twice to ensure that the types are the same (error otherwise).  */
 __UINTPTR_TYPE__ y(int);
 unsigned __intcap y(int);
+#endif
 
 /* Declare twice to ensure that the types are the same (error otherwise).  */
 __PTRADDR_TYPE__ z(int);
@@ -65,5 +67,9 @@ int main()
 	assert (__CHERI_CAP_PERMISSION_PERMIT_EXECUTE__ == 32768);
 	assert (__CHERI_CAP_PERMISSION_PERMIT_STORE__ == 65536);
 	assert (__CHERI_CAP_PERMISSION_PERMIT_LOAD__ == 131072);
+#ifdef __CHERI_PURE_CAPABILITY__
 	return wrapper(__INTPTR_TYPE__);
+#else
+	return 0;
+#endif
 }
diff --git a/gcc/testsuite/gcc.target/aarch64/morello/union-modes.c b/gcc/testsuite/gcc.target/aarch64/morello/union-modes.c
index cb3bdc23051..e8e669b6c3a 100644
--- a/gcc/testsuite/gcc.target/aarch64/morello/union-modes.c
+++ b/gcc/testsuite/gcc.target/aarch64/morello/union-modes.c
@@ -13,5 +13,5 @@ union a g() {
 	return u;
 }
 
-/* { dg-final { scan-rtl-dump-not {reg:DI[^\n]*<retval>} "expand" } } */
-/* { dg-final { scan-rtl-dump {reg:CADI[^\n]*<retval>} "expand" } } */
+/* { dg-final { scan-rtl-dump-not {reg:DI[^\n]*<retval>} "expand" {target {! cheri_capability_hybrid}} } } */
+/* { dg-final { scan-rtl-dump {reg:CADI[^\n]*<retval>} "expand" {target {! cheri_capability_hybrid}} } } */

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

end of thread, other threads:[~2022-11-22 12:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-14 13:24 [gcc(refs/vendors/ARM/heads/morello)] morello testsuite: Fixes for hybrid Alex Coplan
2022-11-22 12:42 Stam Markianos-Wright

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