From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 3CCA43858411; Fri, 21 Jan 2022 07:27:08 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3CCA43858411 From: "rguenther at suse dot de" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/103121] [12 Regression] Warnings in cp/optimize.c causing build failure Date: Fri, 21 Jan 2022 07:27:07 +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.0 X-Bugzilla-Keywords: build, diagnostic X-Bugzilla-Severity: normal X-Bugzilla-Who: rguenther at suse dot de X-Bugzilla-Status: RESOLVED X-Bugzilla-Resolution: FIXED X-Bugzilla-Priority: P1 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 12.0 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: Fri, 21 Jan 2022 07:27:08 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D103121 --- Comment #28 from rguenther at suse dot de --- On Thu, 20 Jan 2022, msebor at gcc dot gnu.org wrote: > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D103121 >=20 > --- Comment #26 from Martin Sebor --- > (In reply to rguenther@suse.de from comment #23) > ... > The cache stores the offset of the pointer SSA_NAME at its definition. S= ince > the SSA_NAME never changes, the context doesn't matter. Or am I missing > something? Consider ptr_1 =3D &a + _2; if (_2 =3D=3D 0) use1 (ptr_1); use2 (ptr_1); if we visit use1 and ask ptr-query for ptr_1 with context 'use1' I expect it to record offset 0 (_2 =3D=3D 0) from &a at the ptr_1 definition in the cache. When we then proceed to use2 and ask ptr-query for ptr_1 with context 'use2' it will find the cached &a + 0, won't it? And that would be wrong here. But as said I only briefly looked at how things work but it does seem that the ability to specify a context to ptr_query but caching things for SSA definitions with query results which use those context can lead to wrong answers down the road.=