From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 7A9203896827; Mon, 29 Nov 2021 08:49:40 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7A9203896827 From: "aldyh at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug ipa/103451] [12 Regression] crash at gcc/range-op.cc:1836 since r12-5531-g1b0acc4b800b589a Date: Mon, 29 Nov 2021 08:49:40 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: ipa X-Bugzilla-Version: 12.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: P1 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 12.0 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: Mon, 29 Nov 2021 08:49:40 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D103451 --- Comment #4 from Aldy Hernandez --- (In reply to Richard Biener from comment #2) > So range-op.cc eventually wants to look at 'cfun' which of course is a > non-go in IPA context. >=20 > void > operator_div::wi_fold (irange &r, tree type, > const wide_int &lh_lb, const wide_int &lh_ub, > const wide_int &rh_lb, const wide_int &rh_ub) const > { > ... > // If flag_non_call_exceptions, we must not eliminate a division by zer= o. > if (cfun->can_throw_non_call_exceptions) > { > r.set_varying (type); > return; >=20 > I'm not sure wi_fold should care about "eliminating a division", but sure= ly > even for non-call EH the actual range of the result doesn't need to care. >=20 > So if sth goes wrong when eliding the above it needs to be fixed upthread > instead? >=20 > Otherwise a "quick" workaround for the ICE is to check !cfun || ... and > be conservative. I see there's no state associated with > range_fold_binary_expr > where the IPA context could pass down relevant can_throw_non_call_excepti= ons. I honestly can't remember what the rationale was for checking can_throw_non_call_exceptions. Perhaps this got added to catch some testca= se?=20 My gut feeling is that we should be fixing whatever issue upstream, but !cf= un || ... seems quite harmless. >=20 > I also see >=20 > bool > fold_using_range::range_of_builtin_call (irange &r, gcall *call, > fur_source &src) > ... > if (cfun->after_inlining) > { > r.set_zero (type); >=20 > which might have similar problems (!cfun || ... looks quite reasonable th= ere) This one came from the old vr-values.c code, so you may have better insight here ;-) commit 46dfa8ad6c18feb45d35734eae38798edb7c38cd Author: Richard Biener Date: Wed Sep 11 11:16:54 2019 +0000 re PR tree-optimization/90387 (__builtin_constant_p and -Warray-bounds warnings) 2019-09-11 Richard Biener PR tree-optimization/90387 * vr-values.c (vr_values::extract_range_basic): After inlining simplify non-constant __builtin_constant_p to false. * gcc.dg/Warray-bounds-44.c: New testcase. From-SVN: r275639=