From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id A64843858419; Wed, 20 Oct 2021 10:06:27 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A64843858419 From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/102853] [12 Regression] ICE in compute_distributive_range, at tree-data-ref.c:593 since r12-4398-g9b2ad21ab3ebc21a3408108327fa1a7cbedaf217 Date: Wed, 20 Oct 2021 10:06:27 +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: ice-on-valid-code X-Bugzilla-Severity: normal X-Bugzilla-Who: rguenth 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.0 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_status cf_gcctarget assigned_to cc 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: Wed, 20 Oct 2021 10:06:27 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D102853 Richard Biener changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |ASSIGNED Target|ppc64-linux-gnu |ppc64-linux-gnu, | |powerpc64le-linux-gnu Assignee|unassigned at gcc dot gnu.org |rguenth at gcc dot = gnu.org CC| |rsandifo at gcc dot gnu.org --- Comment #1 from Richard Biener --- Also on LE, even without -mmodulo. Richard inserted the assert with the la= st refactoring of split_constant_offset. We are splitting the initial value of the IV tmp.9_69 here which is niters_vector_mult_vf.8_68 =3D bnd.7_67 << 3; _70 =3D (long int) niters_vector_mult_vf.8_68; _71 =3D _70 * 2; tmp.9_69 =3D buf_12(D) + _71; and the operation we're asserting on is _70 * 2. Note the IV is (short int *) buf_53 with # buf_53 =3D PHI <..., tmp9_69> so the trigger for the ICE is the added 1373 STRIP_NOPS (access_fn); in dr_analyze_indices. That was necessary to avoid regressions when IVs are demoted to uintptr_t by if-conversion. split_constant_offset makes sure to not look through conversions to trapping types - maybe that check should also be on the individual operatio= ns in case we start analyzing with an expression in trapping types (as done here)? Immediate mitigation would of course be to restrict the STRIP_NOPS to not expose an IV that evolves in a trapping type. For example the following would fix it: diff --git a/gcc/tree-data-ref.c b/gcc/tree-data-ref.c index 57bac06242f..2cae2528e41 100644 --- a/gcc/tree-data-ref.c +++ b/gcc/tree-data-ref.c @@ -775,6 +775,9 @@ split_constant_offset_1 (tree type, tree op0, enum tree_code code, tree op1, case PLUS_EXPR: case MINUS_EXPR: + if (TYPE_OVERFLOW_TRAPS (type)) + return false; + split_constant_offset (op0, &var0, &off0, &op0_range, cache, limit); split_constant_offset (op1, &var1, &off1, &op1_range, cache, limit); *off =3D size_binop (code, off0, off1); @@ -785,7 +788,7 @@ split_constant_offset_1 (tree type, tree op0, enum tree_code code, tree op1, return true; case MULT_EXPR: - if (TREE_CODE (op1) !=3D INTEGER_CST) + if (TREE_CODE (op1) !=3D INTEGER_CST || TYPE_OVERFLOW_TRAPS (type)) return false; split_constant_offset (op0, &var0, &off0, &op0_range, cache, limit); of course (after more work already done), compute_distributive_range could return false itself. Richard?=