From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 2BAF73858D32; Mon, 10 Jul 2023 18:25:50 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2BAF73858D32 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1689013550; bh=O5h4yxAdBP7KuE6EsUt8Tq/Ul/eNGnftoJxKCLxnBug=; h=From:To:Subject:Date:From; b=d08A3+KW0E1asU2inEZoUeNCwPuUfxR13e/E3rkI3ZSnq4M7tA2+Y1J/JQVyig2xV sZlUBB9lL0df/8FbrUlBJjZRqUn0Ef/6aPJwBiKlLkY6HiA3WNpSaGBhzfyOnIDE04 AZYXAq0VfyMzrxjiEq9u540qhLzgOMQ57cmX0Fzc= From: "xry111 at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/110617] New: RFE: Add a diagnostic-only variant of nonnull attribute Date: Mon, 10 Jul 2023 18:25:49 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: middle-end X-Bugzilla-Version: 14.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: enhancement X-Bugzilla-Who: xry111 at gcc dot gnu.org 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=3D110617 Bug ID: 110617 Summary: RFE: Add a diagnostic-only variant of nonnull attribute Product: gcc Version: 14.0 Status: UNCONFIRMED Severity: enhancement Priority: P3 Component: middle-end Assignee: unassigned at gcc dot gnu.org Reporter: xry111 at gcc dot gnu.org Target Milestone: --- Currently nonnull serves as both a diagnostic attribute and an optimization attribute. But sometimes we want only the effect for diagnostic, but not t= he effect for code generation. For example, Glibc developers implements many functions as "crash the progr= am immediately if an unexpected NULL pointer is passed" [1]. So it would be useful to make the potential crash detectable via -Wnonnull and/or -Wanalyzer-null-argument. However they don't like the nonnull attribute on= the function prototype, because the nonnull attribute may cause the optimizer to break their "immediately crash" design [2]. I'm not sure how to name this variant of nonnull precisely. (Maybe "hate_nu= ll or something?)=