https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103056
Bug ID: 103056
Summary: attribute access "none" is not ignored as it should
Product: gcc
Version: 10.3.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: gganne at accedian dot com
Target Milestone: ---
Hi,
Attribute access seems to trigger an error if the access mode isn't recognized.
This is an error (not a warning) and bypasses -Wno-ignored-attributes.
Since gcc-11 added "none" as possible access mode, it is quite possible
that gcc-10 triggers an error on otherwise valid code.
As far as I can tell, this only concern gcc-10.
Below is a sample to show this:
$ gcc --version
gcc (GCC) 10.3.1 20211027
$ cat foo.c
#pragma GCC diagnostic ignored "-Wattributes"
int foo(const void *) __attribute__((access(none, 1)));
$ gcc -c foo.c # same with -Wno-ignored-attributes
foo.c:2:1: error: attribute ‘access’ invalid mode ‘none’; expected one of
‘read_only’, ‘read_write’, or ‘write_only’
2 | int foo(const void *) __attribute__((access(none, 1)));
| ^~~
Best regards,