From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 18FAE3857822; Fri, 29 Apr 2022 08:23:17 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 18FAE3857822 From: "zsojka at seznam dot cz" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/105431] ICE: SIGSEGV in powi_as_mults_1 (tree-ssa-math-opts.cc:1512) with -Ofast and __builtin_pow() Date: Fri, 29 Apr 2022 08:23:16 +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: 13.0 X-Bugzilla-Keywords: ice-on-valid-code X-Bugzilla-Severity: normal X-Bugzilla-Who: zsojka at seznam dot cz 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: --- 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: Fri, 29 Apr 2022 08:23:17 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D105431 --- Comment #4 from Zdenek Sojka --- (In reply to Richard Biener from comment #1) > I can't reproduce in my dev tree but I guess the following will fix it? >=20 > diff --git a/gcc/tree-ssa-math-opts.cc b/gcc/tree-ssa-math-opts.cc > index 7555793948e..f3efd1ef4b2 100644 > --- a/gcc/tree-ssa-math-opts.cc > +++ b/gcc/tree-ssa-math-opts.cc > @@ -1495,7 +1495,7 @@ powi_cost (HOST_WIDE_INT n) >=20=20 > static tree > powi_as_mults_1 (gimple_stmt_iterator *gsi, location_t loc, tree type, > - HOST_WIDE_INT n, tree *cache) > + unsigned HOST_WIDE_INT n, tree *cache) > { > tree op0, op1, ssa_target; > unsigned HOST_WIDE_INT digit; > @@ -1548,7 +1548,7 @@ powi_as_mults (gimple_stmt_iterator *gsi, location_t > loc, > memset (cache, 0, sizeof (cache)); > cache[1] =3D arg0; >=20=20 > - result =3D powi_as_mults_1 (gsi, loc, type, (n < 0) ? -n : n, cache); > + result =3D powi_as_mults_1 (gsi, loc, type, absu_hwi (n), cache); > if (n >=3D 0) > return result; Thank you, I missed that "(n < 0) ? -n : n" in the code... I can confirm the compiler bootstraps, and no longer crashes on the testcas= e. I didn't try to run the testsuite.=