public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "Keith.S.Thompson at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c/108986] Incorrect warning for [static] array parameter
Date: Wed, 01 Mar 2023 18:41:37 +0000	[thread overview]
Message-ID: <bug-108986-4-0t4CG2AdbV@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-108986-4@http.gcc.gnu.org/bugzilla/>

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	other threads:[~2023-03-01 18:41 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-01 18:35 [Bug c/108986] New: " Keith.S.Thompson at gmail dot com
2023-03-01 18:41 ` Keith.S.Thompson at gmail dot com [this message]
2023-03-02 10:11 ` [Bug c/108986] " rguenth at gcc dot gnu.org
2023-03-02 15:42 ` [Bug c/108986] [11/12/13 Regression] " jakub at gcc dot gnu.org
2023-03-02 18:09 ` jakub at gcc dot gnu.org
2023-03-03 15:12 ` cvs-commit at gcc dot gnu.org
2023-03-03 15:19 ` [Bug c/108986] [11/12 " jakub at gcc dot gnu.org
2023-03-19  5:30 ` cvs-commit at gcc dot gnu.org
2023-03-20 10:28 ` [Bug c/108986] [11 " jakub at gcc dot gnu.org
2023-05-08 12:26 ` rguenth at gcc dot gnu.org
2023-08-04 14:06 ` muecker at gwdg dot de

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-108986-4-0t4CG2AdbV@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).