Yes, there are two bugs. The first with [[gnu::access(write_only, 2)]] int f(int n, char * a[n]); And the second with -Wvla-parameter -Wno-attributes [[gnu::access(write_only, 2)]] int f(int n, char * a[n]); int f(int n, char * a[n]); Can you file two bugs? (if those don't exist yet) Martin Am Samstag, dem 14.12.2024 um 00:03 +0100 schrieb Alejandro Colomar: > Hi, > > The diagnostic for the attribute directive ignored was due to an old GCC > version. However, I'm still seeing diagnostics that I think don't make > sense, with GCC 14. > > I think this is a compiler bug (or two), maybe? > > This seems to relate to array parameters; CC += Martin. > > Cheers, > Alex > > alx@www:/tmp$ cat str.c > #include <errno.h> > #include <stddef.h> > #include <string.h> > #include <sys/types.h> > > [[gnu::access(read_write, 1)]] > [[gnu::access(write_only, 4)]] > [[gnu::null_terminated_string_arg(1)]] > [[gnu::null_terminated_string_arg(2)]] > inline ssize_t strsep2arr(char *s, const char *restrict delim, > size_t n, char *a[restrict n]); > > // strsep(3) a string into an array of strings. > // Return the number of fields in the string, or -1 on error. > inline ssize_t strsep2arr(char *s, const char *restrict delim, > size_t n, char *a[restrict n]) > { > size_t i; > > for (i = 0; i < n && s != NULL; i++) > a[i] = strsep(&s, delim); > > if (s != NULL) { > errno = E2BIG; > return -1; > } > > return i; > } > > alx@www:/tmp$ gcc -Wall -Wextra -S str.c > str.c:10:16: warning: attribute ‘access (write_only, 4)’ positional argument 2 missing in previous designation [-Wattributes] > 10 | inline ssize_t strsep2arr(char *s, const char *restrict delim, > | ^~~~~~~~~~ > str.c:11:12: note: designating the bound of variable length array argument 4 > 11 | size_t n, char *a[restrict n]); > | ~~~~~~~^ ~~~~~~~~~~~~~~~~~~~ > str.c:16:21: warning: argument 4 of type ‘char *[restrict n]’ declared as a variable length array [-Wvla-parameter] > 16 | size_t n, char *a[restrict n]) > | ~~~~~~^~~~~~~~~~~~~ > str.c:11:21: note: previously declared as an ordinary array ‘char *[restrict]’ > 11 | size_t n, char *a[restrict n]); > | ~~~~~~^~~~~~~~~~~~~ > str.c: In function ‘strsep2arr’: > str.c:15:16: warning: attribute ‘access (write_only, 4)’ positional argument 2 missing in previous designation [-Wattributes] > 15 | inline ssize_t strsep2arr(char *s, const char *restrict delim, > | ^~~~~~~~~~ > str.c:16:12: note: designating the bound of variable length array argument 4 > 11 | size_t n, char *a[restrict n]); > | ~~~~~~~~~~~~~~~~~~~ > ...... > 16 | size_t n, char *a[restrict n]) > | ~~~~~~~^ > alx@www:/tmp$ gcc --version > gcc (Debian 14.2.0-8) 14.2.0 > Copyright (C) 2024 Free Software Foundation, Inc. > This is free software; see the source for copying conditions. There is NO > warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. > > > >