From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id D71143858C20; Mon, 31 Jan 2022 14:53:43 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D71143858C20 From: "amacleod at redhat dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/104288] [11/12 Regression] EVRP null pointer check removal for strcmp (and maybe others) is not flow senative Date: Mon, 31 Jan 2022 14:53:43 +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: 11.2.1 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: amacleod at redhat dot com X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P1 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 11.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 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 31 Jan 2022 14:53:44 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D104288 --- Comment #5 from Andrew Macleod --- The issue is that the routine to determine non-nullness is being called to check for range-on-entry of the current block instead of just the dominator= s.=20 The trace shows: 24 range_on_entry (value_1_7(D)) to BB 2 25 range_of_stmt (value_1_7(D)) at stmt GIMPLE_NOP TRUE : (25) range_of_stmt (value_1_7(D)) const char * VARYING TRUE : (24) range_on_entry (value_1_7(D)) const char * [1B, +INF] so it correctly determines that the range of value_1_7 is VARYING, but range-on-entry to bb2 is adjusted to be non-null. Ultimately,this is becau= se then routine in question answers the question "is there a non-null referenc= e in block BB". Range on entry should not consider the current block, it should instead sta= rt looking at the dominator to this block. That section of code has changed between gcc11 and 12, so there will be 2 slightly different patches coming.=