From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 3D3BC3858425; Fri, 13 Jan 2023 20:59:50 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3D3BC3858425 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1673643590; bh=QEl1g5FR1aJjeiwv+fr2pwrhjS/oAAONQu5gg0spVck=; h=From:To:Subject:Date:In-Reply-To:References:From; b=n9Iv7AIVQ7P0ivXSaiVZag+GlfzHNZzQ39dA+hZ6dn2Nrzw5AQ5R6OebQ3F+kcLIc vs7nN19DBuA/LAayAe8lSWYgtTTS2Vmt7UdeENSwpVulKHRrjgP4KJrQbi1FiTRvel PWlI4kTXZOYlabwYQTzH39GUzIXu17rUlbltaziI= From: "amacleod at redhat dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/108385] [12 Regression] false positive -Wfree-nonheap-object Date: Fri, 13 Jan 2023 20:59: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, missed-optimization X-Bugzilla-Severity: normal X-Bugzilla-Who: amacleod at redhat dot com 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: 12.3 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: attachments.created 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=3D108385 --- Comment #7 from Andrew Macleod --- Created attachment 54269 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=3D54269&action=3Dedit patch in testing Patch is in testing. We added relation processing to GORI during stage 1, but its very lightly u= sed as we haven't fleshed out a lot of cases. I found a couple of minor issues with it, which I will fix in this patch. Furthermore, there was no op2_range implementation for pointer plus. Norma= lly this is all that would have been needed. I added it and this testcase shou= ld now work. At least the ranges for the offset to pointer_plus now reflect z= ero or nonzero based on known equality/inequality of the 2 operands. ie: : _1 =3D (sizetype) off_5(D); q_7 =3D p_6(D) + _1; if (p_6(D) !=3D q_7) goto ; [INV] else goto ; [INV] _1 : [irange] sizetype [0, 2147483647][18446744071562067968, +INF] 2->3 (T) _1 : [irange] sizetype [1, 2147483647][18446744071562067968, +IN= F] 2->3 (T) off_5(D) : [irange] int [-INF, -1][1, +INF] 2->4 (F) _1 : [irange] sizetype [0, 0] NONZERO 0x0 2->4 (F) off_5(D) : [irange] int [0, 0] NONZERO 0x0 Check and see if it also resolves the original test. It does update the zero/nonzero outgoing ranges.=