From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 57EDB3858D28; Fri, 29 Apr 2022 06:45:11 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 57EDB3858D28 From: "rguenth at gcc dot gnu.org" 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 06:45:11 +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: rguenth at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED 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: 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 06:45:11 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D105431 --- Comment #1 from Richard Biener --- I can't reproduce in my dev tree but I guess the following will fix it? 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) 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; - 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;=