public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Matthew Malcomson <matmal01@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc(refs/vendors/ARM/heads/morello)] Fix some morello tests for stock AArch64
Date: Mon, 14 Mar 2022 10:34:46 +0000 (GMT)	[thread overview]
Message-ID: <20220314103446.E5545385E02D@sourceware.org> (raw)

https://gcc.gnu.org/g:1d2295c56d1a0768df17fa2b7ee711551c8dfec4

commit 1d2295c56d1a0768df17fa2b7ee711551c8dfec4
Author: Matthew Malcomson <matthew.malcomson@arm.com>
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 <stdlib.h>
 #include <assert.h>
 
+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) {


                 reply	other threads:[~2022-03-14 10:34 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220314103446.E5545385E02D@sourceware.org \
    --to=matmal01@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).