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

            Bug ID: 128584
           Summary: Accept address_space(N) as a named address space
                    qualifier
           Product: gcc
           Version: 17.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: vineetg at gcc dot gnu.org
          Reporter: vineetg at gcc dot gnu.org
                CC: dfaust at gcc dot gnu.org, jemarch at gcc dot gnu.org
  Target Milestone: ---

GCC already supports N1275 draft specified Named address space qualifier
keywords.
clang uses a different syntax: __attribute__((address_space(N))) which is used
all over the BPF software stack, for arena subsystem, which GCC needs to
implement.
So this requires some "C" front-end changes.

This can't be done in the attribute handler alone which gets the whole declared
type.

`int __attribute__((mode(QI))) *p' the mode lands on `int *';

A handler would have to push the address space down thru the types to reach the
qualified type. And it needs to discern between attribute written after the `*'
as qualifying the pointer instead; which can't be done from inside the handler.
So this needs to be handled in declspecs_add_attrs.

GCC' existing address space identifiers are target specific and same `N' can
mean different things across targets:

i386   ADDR_SPACE_SEG_FS = 1,  ADDR_SPACE_SEG_GS = 2
gcn    DEFAULT=0, FLAT=1, SCALAR_FLAT=2, FLAT_SCRATCH=3, LDS=4, GDS=5, ...
bpf    ADDR_SPACE_ARENA  = 1

Thus a target hook is needed to "register" the `N' in
__attribute__((address_space(N))), returns a bool, and stores it.

Reply via email to