https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98747

            Bug ID: 98747
           Summary: aarch64: __ARM_FEATURE_MEMORY_TAGGING is defined on
                    ilp32
           Product: gcc
           Version: 10.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: nsz at gcc dot gnu.org
  Target Milestone: ---

memory tagging intrinsics should be available when arm_acle.h
is included and __ARM_FEATURE_MEMORY_TAGGING is defined.

memory tagging is not supported with ILP32 so the feature test
macro should not be defined either, but gcc seems to define it

$ gcc -march=armv8.5-a+memtag -mabi=lp64 -E -dM - </dev/null |grep MEMORY
#define __ARM_FEATURE_MEMORY_TAGGING 1
$ gcc -march=armv8.5-a+memtag -mabi=ilp32 -E -dM - </dev/null |grep MEMORY
#define __ARM_FEATURE_MEMORY_TAGGING 1

i expect the following code to work with any abi and arch combination:

#include <arm_acle.h>

int *foo(int *p, unsigned long m)
{
#ifdef __ARM_FEATURE_MEMORY_TAGGING
    return __arm_mte_create_random_tag(p, m);
#else
    return p;
#endif
}

but with -march=armv8.5-a+memtag -mabi=ilp32 it fails

In file included from <source>:1:
<source>: In function 'foo':
<source>:6:12: error: Memory Tagging Extension does not support '-mabi=ilp32'
    6 |     return __arm_mte_create_random_tag(p, m);
      |            ^~~~~~~~~~~~~~~~~~~~~~~~~~~
Compiler returned: 1

Reply via email to