public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r14-9235] aarch64: Fix memtag builtins vs GC [PR108174]
@ 2024-02-29  7:14 Andrew Pinski
  0 siblings, 0 replies; only message in thread
From: Andrew Pinski @ 2024-02-29  7:14 UTC (permalink / raw)
  To: gcc-cvs

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);
+}

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-02-29  7:14 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-29  7:14 [gcc r14-9235] aarch64: Fix memtag builtins vs GC [PR108174] Andrew Pinski

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