From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 52C4739ABD5D; Mon, 12 Dec 2022 11:20:35 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 52C4739ABD5D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1670844035; bh=ybDRfSsmnfmtJKJ2nL1v+/NWOa73upUXS2U64kZsTMU=; h=From:To:Subject:Date:In-Reply-To:References:From; b=kYh007aYGnNxpe6H7LSiELlmDbNDB2aLwHvE1hV+eBGIRhUMdnvMUlWyOkVZjBAZp JEgsSc6AP89qLpcYNE3ULfmKvYK067yBHeEk2l6FNqTvdoAFs9t/8ihbf/LiSmzhIw LuEyHY7nmIer1sBlM0TqcsD5Okc7ry/hTYA5Ui1o= From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/106868] [12 Regression] Bogus -Wdangling-pointer warning with -O1 Date: Mon, 12 Dec 2022 11:20:33 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Version: 12.2.0 X-Bugzilla-Keywords: diagnostic X-Bugzilla-Severity: normal X-Bugzilla-Who: cvs-commit at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: rguenth at gcc dot gnu.org X-Bugzilla-Target-Milestone: 12.3 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=3D106868 --- Comment #7 from CVS Commits --- The releases/gcc-12 branch has been updated by Richard Biener : https://gcc.gnu.org/g:ad6ace70ba38d2052eeb5adb9672d33f59867be0 commit r12-8972-gad6ace70ba38d2052eeb5adb9672d33f59867be0 Author: Richard Biener Date: Mon Dec 5 10:13:13 2022 +0100 tree-optimization/106868 - bogus -Wdangling-pointer diagnostic The testcase shows we mishandle the case where there's a pass-through of a pointer through a function like memcpy. The following adjusts handling of this copy case to require a taken address and adjust the PHI case similarly. PR tree-optimization/106868 * gimple-ssa-warn-access.cc (pass_waccess::gimple_call_return_arg_ref): Inline into single user ... (pass_waccess::check_dangling_uses): ... here and adjust the call and the PHI case to require that ref.aref is the address of the decl. * gcc.dg/Wdangling-pointer-pr106868.c: New testcase. (cherry picked from commit d492d50f644811327c5976e2c918ab6d906ed40c)=