From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1666) id CAD603858C39; Mon, 12 Jun 2023 09:01:51 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org CAD603858C39 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1686560511; bh=IQvWfhAp2AvT7iIcYYhu4dv74HqbHcNG03UN5O9wtyI=; h=From:To:Subject:Date:From; b=ov7C4iwo2gKSOeQzK0EZPVoaIpT3HYU1We7qIDGCdB/RzWy0B1YpsbTJo5+Rc45kG PSfY0+0vks9mRBg1HkTjW+w07Tdy5EVdZylvq2yTLrum/hgt65Bf6BeuSn2rrbKIVJ LrAcWOhpFPwNuSoHE+jX9CwOON7U4A4UD5lM8WLk= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Richard Biener To: gcc-cvs@gcc.gnu.org Subject: [gcc r14-1706] middle-end/110200 - genmatch force-leaf and convert interaction X-Act-Checkin: gcc X-Git-Author: Richard Biener X-Git-Refname: refs/heads/master X-Git-Oldrev: 2764335bd336f2360d465ffcaa8f2c33f7321ab4 X-Git-Newrev: 820d1aec89c43dbbc70d3d0b888201878388454c Message-Id: <20230612090151.CAD603858C39@sourceware.org> Date: Mon, 12 Jun 2023 09:01:51 +0000 (GMT) List-Id: https://gcc.gnu.org/g:820d1aec89c43dbbc70d3d0b888201878388454c commit r14-1706-g820d1aec89c43dbbc70d3d0b888201878388454c Author: Richard Biener Date: Mon Jun 12 10:17:26 2023 +0200 middle-end/110200 - genmatch force-leaf and convert interaction The following fixes code GENERIC generation for (convert! ...) which currently generates if (TREE_TYPE (_o1[0]) != type) _r1 = fold_build1_loc (loc, NOP_EXPR, type, _o1[0]); if (EXPR_P (_r1)) goto next_after_fail867; else _r1 = _o1[0]; where obviously braces are missing. PR middle-end/110200 * genmatch.cc (expr::gen_transform): Put braces around the if arm for the (convert ...) short-cut. Diff: --- gcc/genmatch.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/gcc/genmatch.cc b/gcc/genmatch.cc index bd6ce3a28f8..5fceeec9780 100644 --- a/gcc/genmatch.cc +++ b/gcc/genmatch.cc @@ -2625,7 +2625,8 @@ expr::gen_transform (FILE *f, int indent, const char *dest, bool gimple, { fprintf_indent (f, indent, "if (TREE_TYPE (_o%d[0]) != %s)\n", depth, type); - indent += 2; + fprintf_indent (f, indent + 2, "{\n"); + indent += 4; } if (opr->kind == id_base::CODE) fprintf_indent (f, indent, "_r%d = fold_build%d_loc (loc, %s, %s", @@ -2648,7 +2649,8 @@ expr::gen_transform (FILE *f, int indent, const char *dest, bool gimple, } if (*opr == CONVERT_EXPR) { - indent -= 2; + fprintf_indent (f, indent - 2, "}\n"); + indent -= 4; fprintf_indent (f, indent, "else\n"); fprintf_indent (f, indent, " _r%d = _o%d[0];\n", depth, depth); }