From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 8DE333858C5E; Wed, 5 Jul 2023 11:31:42 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8DE333858C5E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1688556702; bh=bdK66lVOeUmZLVTBJekNqhcfNbG1EQZjgkBgFo3Rkyw=; h=From:To:Subject:Date:In-Reply-To:References:From; b=eLSy58LHfylO+ifM5Pdk4/e5UEs5CbTvfk/UPzw/vx67H3Y2utA7KtBO9lvHNDazj U+pRwcPrXpyi6MVTHmF03yEGa7kRv7rWkI74RcaG+LVrtAckt2XYsSP0idTi0CZh6K GkHHu9xJOBU8oRx/XTIJuTt+M13pRj2Ko0whgDK8= From: "vultkayn at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug analyzer/109365] Double delete yields -Wanalyzer-use-after-free instead of -Wanalyzer-double-free Date: Wed, 05 Jul 2023 11:31:41 +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: 13.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: vultkayn at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED 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: 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=3D109365 Benjamin Priour changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |vultkayn at gcc dot gnu.org --- Comment #3 from Benjamin Priour --- Changing the second delete expression into a direct call to "operator delet= e" results in the correct warning Wanalyzer-double-free being emitted. This is due to delete expression first calling the destructor and performing extra operations, whose one of them is a dereference. "delete expression" compiled with -O0 results on my x86_64-linux-gnu to analyzer ipa: if (a.0_11 !=3D 0B) goto ; [INV] else goto ; [INV] : *a.0_11 =3D{v} {CLOBBER}; operator delete (a.0_11, 8); : _14 =3D 0; Entry statement of bb3 is the one actually detected as -Wanalyzer-double-fr= ee.=