From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id BCCB83858430; Thu, 18 May 2023 16:01:50 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org BCCB83858430 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1684425710; bh=QLv8fARaNYlT5vIObMbOVGi+20SoFDc72dlB9DjdSUM=; h=From:To:Subject:Date:In-Reply-To:References:From; b=mUPQBo04NTKl4W4zIyo/H8vJ3NLQLGxVVGYJIs6Uef3pAKB9QNnPASJsGC5rGBwCr 2D+lb89zYcfi07/FQjUO9w/6JYjlZeUvFNRPiMfqPr4xC3W2gIEMMIhXXjry3EaNW2 0A4xOSGS7yNIcY92UJ/AJwDXal28MKxLVbaeHYHc= From: "xry111 at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/109891] Null pointer special handling in ostream's operator << for C-strings Date: Thu, 18 May 2023 16:01:50 +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: 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: cc 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 Xi Ruoyao changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |xry111 at gcc dot gnu.org --- Comment #8 from Xi Ruoyao --- (In reply to Jonathan Wakely from comment #7) > Oops, if I'd typed PEDASSERT not PEDANTIC, it would be a deliberate choice > ;-) >=20 > Yes, I think PEDASSERT fits better, based on the documented meaning of it > (which even mentions the std::string((const char*)nullptr) case): > https://gcc.gnu.org/onlinedocs/libstdc++/manual/debug_mode_semantics.html Ccan we add a "pednonnull" attribute or something to produce a -Wnonnull warning like the nonnull attribute but w/o affecting code generation as wel= l?=20 I remember we've discussed "adding nonnull attribute for basic_ostream::operator<<" and the idea was rejected because the nonnull attribute would throw away the null pointer check.=