From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 424A63858C5F; Sat, 20 May 2023 12:58:39 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 424A63858C5F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1684587519; bh=YMek0Z1BIqOTXHO65pQIQTswNFIk8ovScfHv097tdts=; h=From:To:Subject:Date:In-Reply-To:References:From; b=bUXiWinBLE0TBE3qIUXe6idcZjPR73ilWdB+1r95F3HU2r4ILg51oRKnUCKCqz1XA u8camMV1MPMhd+lmORZlzrD3HtKjN9NXRqZI3skrUtpwCCKG5JiUGuOOsbk5psqJfl T/bM031xMo29N/q5Od+7EeNlnrXY7IDVv0rp4SVg= From: "mimomorin at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/109891] Null pointer special handling in ostream's operator << for C-strings Date: Sat, 20 May 2023 12:58:38 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: libstdc++ X-Bugzilla-Version: 14.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: mimomorin 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=3D109891 --- Comment #9 from Michel Morin --- > (which even mentions the std::string((const char*)nullptr) case): > https://gcc.gnu.org/onlinedocs/libstdc++/manual/debug_mode_semantics.html Oh, that's good to know. Understood that PEDASSERT fits better. > can we add a "pednonnull" attribute or something to produce a -Wnonnull=20 > warning like the nonnull attribute but w/o affecting code generation as w= ell? I think such an attribute (like Clang's _Nonnull) would be a nice addition.= So I grepped Nonnull on libc++, but strangely there are __no__ uses of _Nonnull/__nonnull. I only found a few __gnu__::__nonnull__ in __memory_resource/memory_resource.h. In libc++, std::string constructors ha= ve assertions for nullptr check, but there are no attributes.=