From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 79671385829A; Mon, 8 Jan 2024 13:00:58 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 79671385829A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1704718858; bh=BX8FbWc3Clp9qq/3eLqUvAN4Ra0fsqe4cS9PeZ3MAyY=; h=From:To:Subject:Date:In-Reply-To:References:From; b=C17xAlNXQO02yU+TbmbwgG8C1vszIK6VXgWmUvAns9sVrCXt8NZmKvLSzRw06F0Q7 s8pjf922jQ5HdDnhT3Y691+niu6ykMFJRZCcBTPSJagQkp0PX7qs0YAKzRy461jRci 7Q9Q/25IIGZmlXeJacM+ZlaOOS1hCL+TFi8DfmgU= From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/113228] [14 Regression] ICE: recalculate_side_effects, at gimplify.cc:3347 since r14-6420 Date: Mon, 08 Jan 2024 13:00:56 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: middle-end X-Bugzilla-Version: 14.0 X-Bugzilla-Keywords: ice-on-valid-code X-Bugzilla-Severity: normal X-Bugzilla-Who: cvs-commit at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P1 X-Bugzilla-Assigned-To: jakub at gcc dot gnu.org X-Bugzilla-Target-Milestone: 14.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 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D113228 --- Comment #15 from GCC Commits --- The master branch has been updated by Jakub Jelinek : https://gcc.gnu.org/g:8c0dd8a6ff85d6e7b38957f2da400f5cfa8fef6b commit r14-7002-g8c0dd8a6ff85d6e7b38957f2da400f5cfa8fef6b Author: Jakub Jelinek Date: Mon Jan 8 13:59:15 2024 +0100 gimplify: Fix ICE in recalculate_side_effects [PR113228] The following testcase ICEs during regimplificatgion since the addition= of (convert (eqne zero_one_valued_p@0 INTEGER_CST@1)) simplification. That simplification is novel in the sense that in gimplify_expr it can turn an expression (comparison in particular) into a SSA_NAME. Normally when gimplify_expr sees originally a SSA_NAME, it does case SSA_NAME: /* Allow callbacks into the gimplifier during optimization. = */ ret =3D GS_ALL_DONE; break; and doesn't try to recalculate side effects because of that, but in this case gimplify_expr normally enters the: default: switch (TREE_CODE_CLASS (TREE_CODE (*expr_p))) { case tcc_comparison: then does *expr_p =3D gimple_boolify (*expr_p); and then *expr_p =3D fold_convert_loc (input_location, org_type, *expr_p= ); with this new match.pd simplification turns that tcc_comparison class into SSA_NAME. Unlike the outer SSA_NAME handling though, this falls through into recalculate_side_effects (*expr_p); dont_recalculate: break; but unfortunately recalculate_side_effects doesn't handle SSA_NAME and = ICEs on it. SSA_NAMEs don't ever have TREE_SIDE_EFFECTS set on those, so the follow= ing patch fixes it by handling it similarly to the tcc_constant case. 2024-01-08 Jakub Jelinek PR tree-optimization/113228 * gimplify.cc (recalculate_side_effects): Do nothing for SSA_NA= MEs. * gcc.c-torture/compile/pr113228.c: New test.=