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

            Bug ID: 118043
           Summary: -Wattributes: [[gnu::access(wo, n)]]: False positive
                    with VLA
           Product: gcc
           Version: 14.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: alx at kernel dot org
  Target Milestone: ---

alx@devuan:~/tmp/gcc$ cat f.c
[[gnu::access(write_only, 2)]]
int f(int n, int a[n])
{
        a[0] = 42;
        return 0;
}
alx@devuan:~/tmp/gcc$ cc -Wall -Wextra -S f.c 
f.c: In function ‘f’:
f.c:2:5: warning: attribute ‘access (write_only, 2)’ positional argument 2
missing in previous designation [-Wattributes]
    2 | int f(int n, int a[n])
      |     ^
f.c:2:11: note: designating the bound of variable length array argument 2
    2 | int f(int n, int a[n])
      |       ~~~~^

Reply via email to