From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2049) id E5545385E02D; Mon, 14 Mar 2022 10:34:46 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E5545385E02D Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Matthew Malcomson To: gcc-cvs@gcc.gnu.org Subject: [gcc(refs/vendors/ARM/heads/morello)] Fix some morello tests for stock AArch64 X-Act-Checkin: gcc X-Git-Author: Matthew Malcomson X-Git-Refname: refs/vendors/ARM/heads/morello X-Git-Oldrev: 9801bfdd265769750005062c7a0cce23daf97737 X-Git-Newrev: 1d2295c56d1a0768df17fa2b7ee711551c8dfec4 Message-Id: <20220314103446.E5545385E02D@sourceware.org> Date: Mon, 14 Mar 2022 10:34:46 +0000 (GMT) X-BeenThere: gcc-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Mar 2022 10:34:47 -0000 https://gcc.gnu.org/g:1d2295c56d1a0768df17fa2b7ee711551c8dfec4 commit 1d2295c56d1a0768df17fa2b7ee711551c8dfec4 Author: Matthew Malcomson Date: Mon Feb 28 17:11:38 2022 +0000 Fix some morello tests for stock AArch64 known-outside-bounds.c was checking for a warning that we emit when writing out a capability that will end up out of bounds. This warning will not occur on fake-capability since it's based on the machinery of writing capabilities out. packed-structures.c was emitting a large amount of warnings on unaligned pointers. We just remove those warnings since the whole point of the test was about this precise case. unwinding.c (and no-frame-chain-unwind.c which used the same code) had two compilation problems. The first was that `uintptr_t` was not defined but was used. Thes econd was that we had an array of function pointers which was statically initialised. For dynamically linked programs these function addresses are not known at link time. Here we initialise the function pointers dynamically to account for this. Diff: --- .../aarch64/morello/known-outside-bounds.c | 2 +- .../gcc.target/aarch64/morello/packed-structures.c | 1 + .../gcc.target/aarch64/morello/unwinding.c | 22 +++++++++++----------- 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/gcc/testsuite/gcc.target/aarch64/morello/known-outside-bounds.c b/gcc/testsuite/gcc.target/aarch64/morello/known-outside-bounds.c index 896861c2fd6..011f3250806 100644 --- a/gcc/testsuite/gcc.target/aarch64/morello/known-outside-bounds.c +++ b/gcc/testsuite/gcc.target/aarch64/morello/known-outside-bounds.c @@ -4,5 +4,5 @@ const char * foo () { return myvar; -} /* { dg-warning "offset is outside of .* capability from which it is offset" "" { target *-*-* } } */ +} /* { dg-warning "offset is outside of .* capability from which it is offset" "" { target { *-*-* && cheri_capability_pure } } } */ diff --git a/gcc/testsuite/gcc.target/aarch64/morello/packed-structures.c b/gcc/testsuite/gcc.target/aarch64/morello/packed-structures.c index 421eca3c634..d8a1e470f62 100644 --- a/gcc/testsuite/gcc.target/aarch64/morello/packed-structures.c +++ b/gcc/testsuite/gcc.target/aarch64/morello/packed-structures.c @@ -1,3 +1,4 @@ +/* { dg-additional-options "-Wno-if-not-aligned" } */ /* This file is for testing the PCS implementation on packed structures. diff --git a/gcc/testsuite/gcc.target/aarch64/morello/unwinding.c b/gcc/testsuite/gcc.target/aarch64/morello/unwinding.c index ceac96fc7b2..5ab22ea8090 100644 --- a/gcc/testsuite/gcc.target/aarch64/morello/unwinding.c +++ b/gcc/testsuite/gcc.target/aarch64/morello/unwinding.c @@ -26,6 +26,7 @@ #include #include +typedef __UINTPTR_TYPE__ uintptr_t; #define NUM_INTERNAL_CALLS 20 bool check_performed = false; static bool in_func (void *, size_t); @@ -41,17 +42,7 @@ static int ptr_compare (const void *, const void *); static void sort_function_pointers (); int main (int, char**); -static uintptr_t function_pointers[] = { - &in_func, - &trace_function, - &unwind_stop, - &unwind_cleanup, - &test_unwinder, - &foo, - &ptr_compare, - &sort_function_pointers, - &main -}; +static uintptr_t function_pointers[9] = { 0 }; static int foo_index = -1; static int main_index = -1; @@ -277,6 +268,15 @@ static int ptr_compare (const void *a, const void *b) static void sort_function_pointers () { + function_pointers[0] = &in_func; + function_pointers[1] = &trace_function; + function_pointers[2] = &unwind_stop; + function_pointers[3] = &unwind_cleanup; + function_pointers[4] = &test_unwinder; + function_pointers[5] = &foo; + function_pointers[6] = &ptr_compare; + function_pointers[7] = &sort_function_pointers; + function_pointers[8] = &main; size_t num_funcs = sizeof(function_pointers)/sizeof(function_pointers[0]); qsort (function_pointers, num_funcs, sizeof(void *), ptr_compare); for (size_t i = 0; i < num_funcs; ++i) {