From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id DC355385842F; Sat, 22 Oct 2022 01:27:34 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org DC355385842F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1666402054; bh=ziG+RmXSfVKxM1t7CmwMmiXm46S3WXgfRhUECqfxS84=; h=From:To:Subject:Date:In-Reply-To:References:From; b=WTJuohC9eHKyZTKcamwCV5BFPqMifY8ZDb2MGuWYnZcRbjAEQ5Zdf0my/7Y/06YWk GM+hcAtOFC3GKd0b56zPMCFL8URfPvVS33toUEDR2f84IbqRGNYUep1ghdq2zlSH00 R5zshhADAjcmBtGMTNcSrePTvOEVXOEzqT5sD7bk= From: "pinskia at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/106776] Unexpected use-after-free warning Date: Sat, 22 Oct 2022 01:27:34 +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: 12.2.0 X-Bugzilla-Keywords: diagnostic X-Bugzilla-Severity: normal X-Bugzilla-Who: pinskia 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=3D106776 --- Comment #5 from Andrew Pinski --- (In reply to Leandro Nini from comment #2) > Oh, now I see it, it wasn't that obvious in the first test. But why is the > compiler allowed to postpone the store after deleting the pointer? Is the= re > some undefined behavior involved here or what? So the branch where the read after delete happens just happens to be dead c= ode but GCC cannot prove it statically due to what I mentioned in comment #4. Oh if you compile the testcase in comment #4 with -fno-exceptions you don't= get the warning. Or marking f as noexcept. I have not looked into what could be done for either other testcase though.=