From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 0D3543858031; Tue, 11 Jul 2023 10:29:44 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0D3543858031 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1689071385; bh=kDJVcks7P/eyf8QHf7Le3QKYidFxMIYC79q2CYfqL1M=; h=From:To:Subject:Date:In-Reply-To:References:From; b=aN34famvafvhOVKauFYOOuvmhb4+3CEkYY8cetZZtiUZberLa/Hu3A65zV+kBCgRg fjZSdwovRWPVvfEoHjBe//yqWYUJp3O2mxNhqRyTohMRqyEYwcXLIZBsCO2RqHoLlb OM4e1aYIlFlRqM0Q4g/KfFK6x+6a9LS8rVdb22eM= From: "fw at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/110617] RFE: Add a diagnostic-only variant of nonnull attribute Date: Tue, 11 Jul 2023 10:29:43 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: middle-end X-Bugzilla-Version: 14.0 X-Bugzilla-Keywords: diagnostic X-Bugzilla-Severity: enhancement X-Bugzilla-Who: fw 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: 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=3D110617 --- Comment #11 from Florian Weimer --- (In reply to Xi Ruoyao from comment #10) > But Zack's reason against using __nonnull is __nonnull may cause unwanted > optimizations to *the user code*. GCC already offers options to control function call behavior in the presenc= e of nonnull attributes: For function calls: =E2=80=A2 If the compiler determines that a null pointer is passed = in an argument slot marked as non-null, and the =E2=80=98-Wnonnull=E2= =80=99 option is enabled, a warning is issued. *Note Warning Options::. =E2=80=A2 The =E2=80=98-fisolate-erroneous-paths-attribute=E2=80=99= option can be specified to have GCC transform calls with null arguments to non-null functions into traps. *Note Optimize Options::. =E2=80=A2 The compiler may also perform optimizations based on the knowledge that certain function arguments cannot be null. These optimizations can be disabled by the =E2=80=98-fno-delete-null-pointer-checks=E2=80=99 option. *Note = Optimize Options::. So I don't think we need another way to disable nonnull attributes in insta= lled glibc headers.=