From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id EA0C93858C27; Tue, 5 Apr 2022 14:04:23 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org EA0C93858C27 From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/105148] [11/12 Regression] ICE in verify_use, at tree-ssa.cc:881 Date: Tue, 05 Apr 2022 14:04:23 +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.0 X-Bugzilla-Keywords: ice-on-valid-code X-Bugzilla-Severity: normal X-Bugzilla-Who: rguenth at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 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: Tue, 05 Apr 2022 14:04:24 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D105148 --- Comment #4 from Richard Biener --- - MEM [(int[1][0:D.1996] *)y.1_8][5]{lb: 0 sz: _6 * 4}[= i_2] =3D 0; + MEM [(int[1][0:D.1996] *)y.1_8][5]{lb: 0 sz: <<< error >>>}[i_2] =3D 0; find_interesting_uses_op fails to consider _6 * 4, in fact idx_record_use does if (TREE_CODE (base) =3D=3D ARRAY_REF || TREE_CODE (base) =3D=3D ARRAY_RA= NGE_REF) { find_interesting_uses_op (data, array_ref_element_size (base)); find_interesting_uses_op (data, array_ref_low_bound (base)); } but it should probably pass down the raw TREE_OPERANDs, not the scaled array_ref_element_size (). I have a patch: diff --git a/gcc/tree-ssa-loop-ivopts.cc b/gcc/tree-ssa-loop-ivopts.cc index b0305c494cd..81b536f9304 100644 --- a/gcc/tree-ssa-loop-ivopts.cc +++ b/gcc/tree-ssa-loop-ivopts.cc @@ -2124,8 +2124,10 @@ idx_record_use (tree base, tree *idx, find_interesting_uses_op (data, *idx); if (TREE_CODE (base) =3D=3D ARRAY_REF || TREE_CODE (base) =3D=3D ARRAY_R= ANGE_REF) { - find_interesting_uses_op (data, array_ref_element_size (base)); - find_interesting_uses_op (data, array_ref_low_bound (base)); + if (TREE_OPERAND (base, 2)) + find_interesting_uses_op (data, TREE_OPERAND (base, 2)); + if (TREE_OPERAND (base, 3)) + find_interesting_uses_op (data, TREE_OPERAND (base, 3)); } return true; }=