From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id D9B0A386F039; Tue, 13 Oct 2020 07:15:38 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D9B0A386F039 From: "aldyh at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/97396] [11 Regression] ICE: Segmentation fault (in bounds_of_var_in_loop) Date: Tue, 13 Oct 2020 07:15:38 +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: 11.0 X-Bugzilla-Keywords: ice-on-valid-code X-Bugzilla-Severity: normal X-Bugzilla-Who: aldyh at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: aldyh at gcc dot gnu.org X-Bugzilla-Target-Milestone: 11.0 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: 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: Tue, 13 Oct 2020 07:15:39 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D97396 Aldy Hernandez changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |amacleod at redhat dot com --- Comment #2 from Aldy Hernandez --- In bounds_of_var_in_loop, evolution_part_in_loop_num is returning NULL: step =3D evolution_part_in_loop_num (chrec, loop->num); and we ICE while trying to calculate the range for STEP. This is for: (gdb) dd stmt qx.0_3 =3D PHI (gdb) dd var qx.0_3 I'm not familiar with the SCEV code. It looks like NULL is a perfectly val= id response from evolution_part_in_loop_num. Should we just bail if NULL? diff --git a/gcc/vr-values.c b/gcc/vr-values.c index da0b249278b..16f6c629f29 100644 --- a/gcc/vr-values.c +++ b/gcc/vr-values.c @@ -1827,6 +1827,8 @@ bounds_of_var_in_loop (tree *min, tree *max, range_qu= ery *query, init =3D initial_condition_in_loop_num (chrec, loop->num); step =3D evolution_part_in_loop_num (chrec, loop->num); + if (step =3D=3D NULL_TREE) + return false; /* If INIT is an SSA with a singleton range, set INIT to said singleton, otherwise leave INIT alone. */=