From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 8645238555A4; Wed, 26 Jul 2023 13:45:38 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8645238555A4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1690379138; bh=n0+XZWHYqU8WZl170d5ALZWiZSCpBd/HTMnp/nGpaoI=; h=From:To:Subject:Date:From; b=TYefUs50nAQnYkQNzOvzbR+4bNvrn1R92nlX6lJHWt1kM83UTPB4eYBquxFhQyKqv FqeAh8OmQwoU8DqP6VY3nfpDbTsM69YMVSEE2F3/72RU//xYMpgTLds7nHnC86h8KZ pu2PI1PFuvMdsuYgKg2ARhhUzA2NhyA9f0qACrX0= From: "muecker at gwdg dot de" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/110815] New: [static] not as useful as the nonnull attribute Date: Wed, 26 Jul 2023 13:45:38 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c X-Bugzilla-Version: unknown X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: muecker at gwdg dot de 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: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: 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=3D110815 Bug ID: 110815 Summary: [static] not as useful as the nonnull attribute Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: muecker at gwdg dot de Target Milestone: --- C code increasingly uses void foo(char buf[static 10]); to indicate that buf is a non-null pointer. GCC already has some warnings for this but all you would get with the nonnu= ll attribute. In particular, -Wnonnull-compare is missing.=20 void foo (int a[static 1]) { if ((void*)0 =3D=3D a) // should warn return; } https://godbolt.org/z/E6E33Pa8h=