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>
This commit is contained in:
Andrew Pinski 2024-02-28 22:39:32 -08:00
parent aab1c5dcd2
commit 5ec7740496
2 changed files with 17 additions and 1 deletions

View file

@ -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;

View file

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