From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 47D5D3858C62; Mon, 5 Dec 2022 09:41:52 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 47D5D3858C62 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1670233312; bh=vRNvC+nMEWIqOu+XoU0N2nwfp1Ze+GCWt+BgqNBAtRE=; h=From:To:Subject:Date:In-Reply-To:References:From; b=vrDK0w9wQ4GDHf1VJ50zqbVR82mBjtjRy5W5QWaN2fQf7JcdmXubEB5XZiPIPq0tk iD1WTxIWCDUVAeMOtgyO4vjb4AKjk4cMPDCHIZacW8sBakuSKV2N5K7yf5Mu1qD9Yq 9UpyFcvt8eHIu6WSXxQPVluGh6LE2CYD/6KfQRv0= From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/106868] [12/13 Regression] Bogus -Wdangling-pointer warning with -O1 Date: Mon, 05 Dec 2022 09:41:49 +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: rguenth 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: bug_status assigned_to 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 Richard Biener changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |ASSIGNED Assignee|unassigned at gcc dot gnu.org |rguenth at gcc dot = gnu.org --- Comment #4 from Richard Biener --- I'm testing a variant of the patch that instead makes the argument pass-thr= ough work the same as the PHI pass-through which instead does if (!m_ptr_qry.get_ref (arg, phi, &aref, 0) || (aref.deref =3D=3D 0 && POINTER_TYPE_P (TREE_TYPE (aref.ref)))) continue; thus disallows aref.deref =3D=3D 0 with pointer type which is what happens = in this case as well. OTOH it doesn't make much sense to me either - but then the .get_ref documentation is very sparse and the API very complicated. I _think_ that the get_ref (via compute_objsize) returns the object that 'arg' references (points-to) in aref.ref, but how aref.deref is then set is a mystery to me. It _seems_ that we want to have < 0 here as martin indicated but that would mean the PHI case is wrong as well (and the POINTER_TYPE_P check very odd). It also seems that for the call case we might want to call check_dangling_uses (var, aref.ref, true) for aref.deref =3D=3D 0? I'm going to test this piecewise.=