From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 10CC63858D39; Tue, 14 Mar 2023 12:51:35 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 10CC63858D39 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1678798295; bh=FQQEtzmLf9MI5UmkjqmLsirNlJWDATrZs/xgjlru26s=; h=From:To:Subject:Date:In-Reply-To:References:From; b=eHKbdM5LfFYxjlrx/gOL3oBWLcxVlcP5uHG19vzX4KZ3jttjcHGC9jWubnkH6jUG0 3Ih7ZSefig7i7il4z1EQRXBADM/EEFnACKXQtIbDPPgExFFj+TVPEe4oT2dduXVHGH NEBhyIMlSup5+GAfF+72KJ00gIW+u8WpUFPfIWEk= From: "manu at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/109123] Bogus warning: pointer used after 'realloc' -Wuse-after-free with -O2 Date: Tue, 14 Mar 2023 12:51:34 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c X-Bugzilla-Version: 12.2.1 X-Bugzilla-Keywords: diagnostic X-Bugzilla-Severity: normal X-Bugzilla-Who: manu at gcc dot gnu.org X-Bugzilla-Status: NEW 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=3D109123 --- Comment #8 from Manuel L=C3=B3pez-Ib=C3=A1=C3=B1ez --- (In reply to Richard Biener from comment #7) > Warning for "escapes" (the store is an escape point) is also sensible I > think. Would it be possible to make this distinction at the point of warning?=20 > Warning for other uses is really only sensible before any code motion pass > took place. Can you move the warning pass before the first code motion pass?=20 Or split it in two warning passes: warning for any uses (before code motion) and warn for escapes and deref (after code motion)? > Unfortunately the testsuite is full of cases expected to be diagnosed but > are no longer with any change to the operation. It is better to miss some warnings rather than warn too much because otherw= ise users will use any means available to silence them (often -Wno-use-after-fr= ee) and the useful warnings will be lost. For comprehensive code analysis, users should look at the static analyzer.=