From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 6F36A385841B; Sat, 5 Nov 2022 16:44:14 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6F36A385841B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1667666654; bh=gGsVkb2MkcS+f7XWYBsy0BUwl/N24FPcJHKM8a3yHHw=; h=From:To:Subject:Date:In-Reply-To:References:From; b=Iks9AgWtuUnGE01N0ERJ6yEV+Yzw4F0V/ZUhWY0qvzkOPShM55LIOOTMZ38onANvp 5or8xo7nr1p4bDeYtoOs0i3U8s/xur4m9MMxuvVzHYCvk2FytM6ImV0IjqwfphvGuS dP/Z64muDDwU9lV+uLhTlTAtW5yMIw2aQPzJmR20= From: "dmalcolm at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug analyzer/94355] support for C++ new expression Date: Sat, 05 Nov 2022 16:44:13 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: analyzer X-Bugzilla-Version: 10.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: dmalcolm at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: dmalcolm 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=3D94355 --- Comment #13 from David Malcolm --- (In reply to Jonathan Wakely from comment #10) [...snip...] > As already noted above, new can't return null here, and there is no > dereference anyway. And the pointer isn't leaked, but it seems maybe the > analyzer doesn't know about destructors? FWIW the analyzer (presumably incorrectly) considers the case where operator new returns NULL, and then attempts to write 0 to it. The leak is due to the analyzer (presumably incorrectly) following the EH c= fg edge from BB 2 to BB 5 below. int main () { struct S s; int D.2800; int _5; : S::S (&s); : S::~S (&s); s =3D{v} {CLOBBER(eol)}; _5 =3D 0; : : return _5; : : s =3D{v} {CLOBBER(eol)}; resx 1 }=