From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 57C83385783F; Thu, 16 Mar 2023 07:30:37 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 57C83385783F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1678951837; bh=U9zZlbmLbIpWRbN/fJQzPQai/iTmEuNUhWVlqmDcQZQ=; h=From:To:Subject:Date:In-Reply-To:References:From; b=Z5qLLPJ+UjtApEx0zpWQnTBIXIGC7XIcIWTizcmfDcJN423wM9IOXf1inLkmbuW/S 6m4kJwjiPx/a8d239ODjoMaSifbJ7H9NgQ29ADQAc9zjEl2lNcNH6pOrt/lsuFg6Dc 2f2ktrsA7PwZqsFynvAPvWzWKPCu0eu2NROAzGnI= From: "cvs-commit 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: Thu, 16 Mar 2023 07:30:36 +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: cvs-commit 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 #10 from CVS Commits --- The master branch has been updated by Richard Biener : https://gcc.gnu.org/g:0a07bfad12530bca5dc5188057ad910198780dbc commit r13-6707-g0a07bfad12530bca5dc5188057ad910198780dbc Author: Richard Biener Date: Wed Mar 15 09:12:33 2023 +0100 tree-optimization/109123 - run -Wuse-afer-free only early The following switches the -Wuse-after-free diagnostics from emitted during the late access warning passes to the early access warning passes to make sure we run before passes performing code motion run which are the source of a lot of false positives on use-after-free not involving memory operations. The patch also fixes an issue in c-c++-common/Wuse-after-free-6.c and causes the name of the unused pointer to appear in the diagnostic for extra cases in gcc.dg/Wuse-after-free-2.c PR tree-optimization/109123 * gimple-ssa-warn-access.cc (pass_waccess::warn_invalid_pointer= ): Do not emit -Wuse-after-free late. (pass_waccess::check_call): Always check call pointer uses. * gcc.dg/Wuse-after-free-pr109123.c: New testcase. * gcc.dg/Wuse-after-free-2.c: Amend expected diagnostic with the name of the pointer. * c-c++-common/Wuse-after-free-6.c: Un-XFAIL case.=