From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 9022B38708B4; Fri, 18 Aug 2023 13:05:12 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9022B38708B4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1692363912; bh=dnMURKat/zW6IKukz35PKaCpAz8Mefy0TG37m4v06I4=; h=From:To:Subject:Date:In-Reply-To:References:From; b=UB4cgmQhF64OpjB63vei8QDptaBgzL6iwqdW4F8T7y79cWi+qqzXSSaOIFuXXup8I QbCCJLAdrIFE32UFVXb8NBIbBq13pMEJ2DNefESZhQU3RtRqyO7+rhTqyMIkxXZbn+ f9FZaTimv1z0mOCslmnKbzjVoJf1EGe3tVu9bb1E= From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/111019] [12/13/14 Regression] Optimizer incorrectly assumes variable is not changed while change happens through another pointer Date: Fri, 18 Aug 2023 13:05:11 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ 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 #10 from CVS Commits --- The master branch has been updated by Richard Biener : https://gcc.gnu.org/g:745ec2135aabfbe2c0fb7780309837d17e8986d4 commit r14-3325-g745ec2135aabfbe2c0fb7780309837d17e8986d4 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.=