Re: [PATCH 1/2] Compiler Attributes: Add __access macro

From: Arnd Bergmann

Date: Tue Apr 21 2026 - 15:30:59 EST


On Tue, Apr 21, 2026, at 21:20, Marco Elver wrote:
> On Tue, 21 Apr 2026 at 21:15, Miguel Ojeda
> <miguel.ojeda.sandonis@xxxxxxxxx> wrote:
>>
>> On Tue, Apr 21, 2026 at 9:04 PM Marco Elver <elver@xxxxxxxxxx> wrote:
>> >
>> > Add support for the `__access__` attribute, which is supported since gcc
>> > >= 11 but not currently supported by clang.
>>
>> > + * Optional: only supported since gcc >= 11
>>
>> From a quick try in Compiler Explorer, it seems GCC recognizes it
>> starting with GCC 10 rather than 11. It also seems to be in the docs.
>> Is there a reason for the 11?
>
> Oh, will fix. In the original report by Arnd we somehow concluded it
> was 11, but I guess I should double check such things. :-)

gcc-10 knows the 'access' attribute, but not the 'none' variant:

echo 'int f(void *p) __attribute__((access(none, 1)));' | /home/arnd/cross/arm64/gcc-10.5.0-nolibc/aarch64-linux/bin/aarch64-linux-gcc -xc - -o /dev/null -c
<stdin>:1:1: error: attribute 'access' invalid mode 'none'; expected one of 'read_only', 'read_write', or 'write_only'

Arnd