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

--- Comment #1 from Keith Thompson <Keith.S.Thompson at gmail dot com> ---
A similar case. The warning refers to the size in bytes, but unlike
the first case it's not incorrect, though referring to the length
would IMHO be clearer.

Note also that the warning appears twice. It only appears once in gcc 11.2.0.

Let me know if I should submit a new bug report for this.

$ cat c.c
#include <stddef.h>

void f(int a[static 7]) { }

int main(void) {
    f(NULL);
}
$ /o/apps/gcc-12.2.0/bin/gcc --version | head -n 1
gcc (GCC) 12.2.0
$ /o/apps/gcc-12.2.0/bin/gcc -Wall -c c.c
c.c: In function ‘main’:
c.c:6:5: warning: argument 1 to ‘int[static 28]’ is null where non-null
expected [-Wnonnull]
    6 |     f(NULL);
      |     ^~~~~~~
c.c:3:6: note: in a call to function ‘f’
    3 | void f(int a[static 7]) { }
      |      ^
c.c:6:5: warning: argument 1 to ‘int[static 28]’ is null where non-null
expected [-Wnonnull]
    6 |     f(NULL);
      |     ^~~~~~~
c.c:3:6: note: in a call to function ‘f’
    3 | void f(int a[static 7]) { }
      |      ^
$

Reply via email to