From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 49BE33853545; Mon, 27 Nov 2023 11:35:15 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 49BE33853545 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1701084915; bh=a6JC7xV02fW4KZqNpN7kxa0eWz7DSCmjOM2dEIKkpow=; h=From:To:Subject:Date:In-Reply-To:References:From; b=AlQLl7mFhcvieoqQUJTQj+CXXxZ1NFbfocW/vZ/m5ibB5KZ/voBaW3nhbTZv8FhIf tnXYpfYK+HoxF1rdwtEiYG0C+VQKQjf+QUPzPrGsnGYp5LGWoqU6ijjT9mF/4GqLIQ s4cMLZNSUgLPLBbbnB9vuKDSzGZ7fYdSHAIbgsrM= From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/111019] [12 Regression] Optimizer incorrectly assumes variable is not changed while change happens through another pointer Date: Mon, 27 Nov 2023 11:35:13 +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.3.0 X-Bugzilla-Keywords: alias, wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: cvs-commit at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: rguenth at gcc dot gnu.org X-Bugzilla-Target-Milestone: 12.4 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=3D111019 --- Comment #14 from GCC Commits --- The releases/gcc-12 branch has been updated by Richard Biener : https://gcc.gnu.org/g:b66fd93a60d429f97ca5fdfb9a88f291c605d002 commit r12-10010-gb66fd93a60d429f97ca5fdfb9a88f291c605d002 Author: Richard Biener Date: Thu Aug 17 15:21:33 2023 +0200 tree-optimization/111019 - invariant motion and aliasing The following fixes a bad choice in representing things to the alias oracle by LIM which while correct in pieces is inconsistent with itself. When canonicalizing a ref to a bare deref instead of leaving the base object and the extracted offset the same and just substituting an alternate ref the following replaces the base and the offset as well, avoiding the confusion that otherwise will arise in aliasing_matching_component_refs_p. PR tree-optimization/111019 * tree-ssa-loop-im.cc (gather_mem_refs_stmt): When canonicalizi= ng also scrap base and offset in case the ref is indirect. * g++.dg/torture/pr111019.C: New testcase. (cherry picked from commit 745ec2135aabfbe2c0fb7780309837d17e8986d4)=