From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 620103857805; Thu, 8 Apr 2021 07:19:45 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 620103857805 From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/99966] Bounds check not eliminated by assert Date: Thu, 08 Apr 2021 07:19:45 +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: X-Bugzilla-Severity: normal X-Bugzilla-Who: rguenth at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cf_reconfirmed_on everconfirmed bug_status blocked 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: Thu, 08 Apr 2021 07:19:45 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D99966 Richard Biener changed: What |Removed |Added ---------------------------------------------------------------------------- Last reconfirmed| |2021-04-08 Ever confirmed|0 |1 Status|UNCONFIRMED |NEW Blocks| |85316 --- Comment #1 from Richard Biener --- For the testcase the issue is that the range check is inside the loop and eliminating it requires symbolic range propagation to work "better". We arrive at i_28: long unsigned int [_32, +INF] EQUIVALENCES: { i_1 i_12 } (2 elements) i_12: size_t VARYING for [local count: 118253447]: if (start_4(D) < end_5(D)) goto ; [99.96%] else goto ; [0.04%] [local count: 118206146]: _9 =3D MEM[(const struct vector *)data_7(D)].D.18843._M_impl.D.18156._M_f= inish; _8 =3D MEM[(const struct vector *)data_7(D)].D.18843._M_impl.D.18156._M_s= tart; _14 =3D _9 - _8; _15 =3D _14 /[ex] 8; _16 =3D (long unsigned int) _15; _33 =3D _16 >=3D end_5(D); _34 =3D _16 > start_4(D); _22 =3D _33 & _34; if (_22 !=3D 0) goto ; [99.92%] else goto ; [0.08%] [local count: 141847]: __assert_fail ("start < end && start < data.size() && end <=3D data.size(= )", "t.C", 7, "uint64_t f(std::vector&, size_t, size_t)"); [local count: 834435851]: if (i_12 >=3D _16) goto ; [0.05%] else goto ; [99.95%] [local count: 381018]: # i_38 =3D PHI std::__throw_out_of_range_fmt ("vector::_M_range_check: __n (which is %zu= ) >=3D this->size() (which is %zu)", i_38, _16); [local count: 952166435]: # total_3 =3D PHI # i_2 =3D PHI _10 =3D MEM[(value_type &)_8 + i_2 * 8]; total_11 =3D total_3 + _10; i_12 =3D i_2 + 1; if (i_12 !=3D end_5(D)) goto ; [87.64%] else goto ; [12.36%] [local count: 117730583]: # total_37 =3D PHI return total_37; Referenced Bugs: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D85316 [Bug 85316] [meta-bug] VRP range propagation missed cases=