From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id A23183858D3C; Wed, 1 Mar 2023 18:41:37 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A23183858D3C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1677696097; bh=pG3wghg0hvAx7ck8cWSL1cBFfViXEZsEa+Kl9l1GN/c=; h=From:To:Subject:Date:In-Reply-To:References:From; b=wPNTLFDiUW9M6BpduUBSAswulPDG6Yetcp/4YCyFzKBx8I8+JPbeT3dBI5sKFgiVC S+/byeS+cFZVGHtce//vkzkKYy4KuvD9Q5a3zvn3Q6+nozUGzZ9yUF6BhJ2oKRyLVG Lcou//Rze35DFAi2sabN25gnAlkWSPIIDorjhPik= From: "Keith.S.Thompson at gmail dot com" 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 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c X-Bugzilla-Version: 12.2.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: Keith.S.Thompson at gmail dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D108986 --- Comment #1 from Keith Thompson --- 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 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 =E2=80=98main=E2=80=99: c.c:6:5: warning: argument 1 to =E2=80=98int[static 28]=E2=80=99 is null wh= ere non-null expected [-Wnonnull] 6 | f(NULL); | ^~~~~~~ c.c:3:6: note: in a call to function =E2=80=98f=E2=80=99 3 | void f(int a[static 7]) { } | ^ c.c:6:5: warning: argument 1 to =E2=80=98int[static 28]=E2=80=99 is null wh= ere non-null expected [-Wnonnull] 6 | f(NULL); | ^~~~~~~ c.c:3:6: note: in a call to function =E2=80=98f=E2=80=99 3 | void f(int a[static 7]) { } | ^ $=