From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2109) id 3B93038582A4; Tue, 22 Nov 2022 12:42:57 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3B93038582A4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1669120977; bh=EVAlITGgruF84jQaGVDtz+DuKE7ruVZE4hsY2jgPMUA=; h=From:To:Subject:Date:From; b=EF5t0aJwMEUFboXBS5HAWvYG71ag+CQvXa2rWCi62RXJzJjfvqSci4vroNW4mZN00 j6Mmy52Ge722ddJSVH8ZQjMaCjIiuYURf8noq+qkt/E3XR2q6mgMW0XKewm3/nsOLN KIzE/9fWjyXRp/KWHZlfLvgmLVxbzX3GAr8V+AaM= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Stam Markianos-Wright To: gcc-cvs@gcc.gnu.org Subject: [gcc(refs/vendors/ARM/heads/morello)] morello testsuite: Fixes for hybrid X-Act-Checkin: gcc X-Git-Author: Alex Coplan X-Git-Refname: refs/vendors/ARM/heads/morello X-Git-Oldrev: e448c8a34a5188d6ff570c59ed60c5280c7b3ca9 X-Git-Newrev: d8b6037e5336e1990413229358884dada7eadfc5 Message-Id: <20221122124257.3B93038582A4@sourceware.org> Date: Tue, 22 Nov 2022 12:42:57 +0000 (GMT) List-Id: https://gcc.gnu.org/g:d8b6037e5336e1990413229358884dada7eadfc5 commit d8b6037e5336e1990413229358884dada7eadfc5 Author: Alex Coplan 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]*} "expand" } } */ -/* { dg-final { scan-rtl-dump {reg:CADI[^\n]*} "expand" } } */ +/* { dg-final { scan-rtl-dump-not {reg:DI[^\n]*} "expand" {target {! cheri_capability_hybrid}} } } */ +/* { dg-final { scan-rtl-dump {reg:CADI[^\n]*} "expand" {target {! cheri_capability_hybrid}} } } */