public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Andrew Pinski <pinskia@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r14-9235] aarch64: Fix memtag builtins vs GC [PR108174]
Date: Thu, 29 Feb 2024 07:14:21 +0000 (GMT)	[thread overview]
Message-ID: <20240229071421.A16C33858C3A@sourceware.org> (raw)

https://gcc.gnu.org/g:5ec7740496a6908b32cd058c0520a2bd5a689bb5

commit r14-9235-g5ec7740496a6908b32cd058c0520a2bd5a689bb5
Author: Andrew Pinski <quic_apinski@quicinc.com>
Date:   Wed Feb 28 22:39:32 2024 -0800

    aarch64: Fix memtag builtins vs GC [PR108174]
    
    The memtag builtins were being GC'ed away so we end up
    with a crash sometimes (maybe even wrong code).
    This fixes that issue by adding GTY on the variable/struct
    aarch64_memtag_builtin_data.
    
    Committed as obvious after a build/test for aarch64-linux-gnu.
    
            PR target/108174
    
    gcc/ChangeLog:
    
            * config/aarch64/aarch64-builtins.cc (aarch64_memtag_builtin_data): Make
            static and mark with GTY.
    
    gcc/testsuite/ChangeLog:
    
            * gcc.target/aarch64/acle/memtag_4.c: New test.
    
    Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>

Diff:
---
 gcc/config/aarch64/aarch64-builtins.cc           |  2 +-
 gcc/testsuite/gcc.target/aarch64/acle/memtag_4.c | 16 ++++++++++++++++
 2 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/gcc/config/aarch64/aarch64-builtins.cc b/gcc/config/aarch64/aarch64-builtins.cc
index 277904f6d14..75d21de1401 100644
--- a/gcc/config/aarch64/aarch64-builtins.cc
+++ b/gcc/config/aarch64/aarch64-builtins.cc
@@ -1840,7 +1840,7 @@ aarch64_init_prefetch_builtin (void)
 }
 
 /* Initialize the memory tagging extension (MTE) builtins.  */
-struct
+static GTY(()) struct GTY(())
 {
   tree ftype;
   enum insn_code icode;
diff --git a/gcc/testsuite/gcc.target/aarch64/acle/memtag_4.c b/gcc/testsuite/gcc.target/aarch64/acle/memtag_4.c
new file mode 100644
index 00000000000..1e209ffc25a
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/acle/memtag_4.c
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+/* { dg-options "-march=armv9-a+memtag  --param ggc-min-expand=0 --param ggc-min-heapsize=0" } */
+/* PR target/108174 */
+/* Check to make sure that the builtin functions are not GC'ed away. */
+#include "arm_acle.h"
+
+void g(void)
+{
+  const char *c;
+  __arm_mte_increment_tag(c , 0 );
+}
+void h(void)
+{
+  const char *c;
+  __arm_mte_increment_tag( c,0);
+}

                 reply	other threads:[~2024-02-29  7:14 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=20240229071421.A16C33858C3A@sourceware.org \
    --to=pinskia@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).