From patchwork Sat Jul 1 08:22:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Pinski X-Patchwork-Id: 115012 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp10903909vqr; Sat, 1 Jul 2023 01:23:25 -0700 (PDT) X-Google-Smtp-Source: APBJJlEJjd8Jx3UiBskMI7T99mlqXcTCtSL1VPeHUrVr0x0IVNt8cuUsZTjrgzWQNTUOF4k17Qfo X-Received: by 2002:aa7:d819:0:b0:51e:234:cb69 with SMTP id v25-20020aa7d819000000b0051e0234cb69mr476257edq.15.1688199805413; Sat, 01 Jul 2023 01:23:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688199805; cv=none; d=google.com; s=arc-20160816; b=hEUdHpSjhAqorBsN3CKFU1PWsLrLNU0kmxdYqFD4laR2aXvijSTSGa9i5E715HVW0U O+RrgCPo/oVCbRM476bicz8BP/7woznOj/Vt8zLhAZ4orRqX6j29PrgF3XLd0MBGFEtY uUUu836PNOBIYi9DtaYo0xl9cU7bfCmTkoFKbmF9z1nCmv7cmFvVi7a24LXZ2PKP3TA4 f4dI9krOrJ+nzX5cZ2OQLuyArZzdHlp3NnNnXOrJjR3wEcpf3NAyvSZiINsFEjYSS9D/ OyEaNCXeSkv4Id9ux0MLX7HcCbR6yTgotbM8nNeXtZzE25RgvwAmhRLKcMbn8oHTA1nM OOEw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence :content-transfer-encoding:mime-version:message-id:date:subject:cc :to:dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=S5dIyz416YPDjUoAAkEGDxWKavamG9+nkmeId2FMFY4=; fh=XbcmRug6/SzczusyoNU1I7Lu5oY0AN2u0mWDzKoxdSs=; b=qqKbN2uZoS4UJARKGWnGAgpm4rXkJDjaGj1/Shs+/nRUuQYFSF3jvWGyrkWd6KkTQq kAFd6Wz0/lwvRECdz0pMNPDPFGdRgvbPZr+0X+gH5P/xThmc2FnkptM5//XQJ2uelQ2u Wn3kLjP1th03NCvsYOgm93vGZMUEADZ/XOrW/SzL7XAAqSscHrzT8NQJ3ehcTep6uAzg liRnAx/AZsLpdqG8lmOmAhUUZ/uc0h8ChU1vW3s8dHj/lDXKD2etODCdQ9R3O26l5h6b xy/9bv2qjhBHPrpK3Atnb5NWTdc21x4OWT/YHraqZLS1zD01ZEtus7xH2B0blCay9fAL EUJw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=b67q62pb; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id v12-20020aa7cd4c000000b0051d80279e56si305939edw.70.2023.07.01.01.23.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 01 Jul 2023 01:23:25 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=b67q62pb; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 3F05E3858418 for ; Sat, 1 Jul 2023 08:23:21 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3F05E3858418 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1688199801; bh=S5dIyz416YPDjUoAAkEGDxWKavamG9+nkmeId2FMFY4=; h=To:CC:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=b67q62pbBk89luxEZ40AIiipL/2fSmcjfP0aWSwsz7OvwqgsxQXm/OYf9pfiyNx6A vTJmq6z6NTA6VHWV3wcbmyzcyy0iHqpX36cdVuse0s4kAEjjsfD6pzN9WT0DtW5LBW rwe66YS2j0h4actG/9WuWOBC+nfPKwbHlGiuAGLo= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by sourceware.org (Postfix) with ESMTPS id B58FC3858D35 for ; Sat, 1 Jul 2023 08:22:28 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org B58FC3858D35 Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 36180RHK023157 for ; Sat, 1 Jul 2023 01:22:27 -0700 Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3rhp2emw7s-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Sat, 01 Jul 2023 01:22:27 -0700 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Sat, 1 Jul 2023 01:22:25 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.48 via Frontend Transport; Sat, 1 Jul 2023 01:22:25 -0700 Received: from vpnclient.wrightpinski.org.com (unknown [10.69.242.187]) by maili.marvell.com (Postfix) with ESMTP id 4B2B03F707B; Sat, 1 Jul 2023 01:22:25 -0700 (PDT) To: CC: Andrew Pinski Subject: [PATCH 1/2] Fix PR 110487: invalid signed boolean value Date: Sat, 1 Jul 2023 01:22:15 -0700 Message-ID: <20230701082216.299104-1-apinski@marvell.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: oyOsBbzEJaBXO-RL3hv0JN7B8kP6FEzn X-Proofpoint-GUID: oyOsBbzEJaBXO-RL3hv0JN7B8kP6FEzn X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-07-01_06,2023-06-30_01,2023-05-22_02 X-Spam-Status: No, score=-14.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Andrew Pinski via Gcc-patches From: Andrew Pinski Reply-To: Andrew Pinski Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1770205798659016528?= X-GMAIL-MSGID: =?utf-8?q?1770205798659016528?= This fixes the first part of this bug where `a ? -1 : 0` would cause a value of 1 into the signed boolean value. It fixes the problem by casting to an integer type of the same size/signedness before doing the negative and then casting to the type of expression. OK? Bootstrapped and tested on x86_64. gcc/ChangeLog: * match.pd (a?-1:0): Cast type an integer type rather the type before the negative. (a?0:-1): Likewise. --- gcc/match.pd | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/gcc/match.pd b/gcc/match.pd index 45c72e733a5..a0d114f6a16 100644 --- a/gcc/match.pd +++ b/gcc/match.pd @@ -4703,7 +4703,12 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT) /* a ? -1 : 0 -> -a. No need to check the TYPE_PRECISION not being 1 here as the powerof2cst case above will handle that case correctly. */ (if (INTEGRAL_TYPE_P (type) && integer_all_onesp (@1)) - (negate (convert (convert:boolean_type_node @0)))))) + (with { + auto prec = TYPE_PRECISION (type); + auto unsign = TYPE_UNSIGNED (type); + tree inttype = build_nonstandard_integer_type (prec, unsign); + } + (convert (negate (convert:inttype (convert:boolean_type_node @0)))))))) (if (integer_zerop (@1)) (with { tree booltrue = constant_boolean_node (true, boolean_type_node); @@ -4722,7 +4727,20 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT) /* a ? -1 : 0 -> -(!a). No need to check the TYPE_PRECISION not being 1 here as the powerof2cst case above will handle that case correctly. */ (if (INTEGRAL_TYPE_P (type) && integer_all_onesp (@2)) - (negate (convert (bit_xor (convert:boolean_type_node @0) { booltrue; } )))) + (with { + auto prec = TYPE_PRECISION (type); + auto unsign = TYPE_UNSIGNED (type); + tree inttype = build_nonstandard_integer_type (prec, unsign); + } + (convert + (negate + (convert:inttype + (bit_xor (convert:boolean_type_node @0) { booltrue; } ) + ) + ) + ) + ) + ) ) ) ) From patchwork Sat Jul 1 08:22:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Pinski X-Patchwork-Id: 115013 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp10903916vqr; Sat, 1 Jul 2023 01:23:26 -0700 (PDT) X-Google-Smtp-Source: APBJJlGi3OE5zl9vWnxe95RCBK2GLfFvtpCldJIrD9pHmQHRCoA675OI4Nw/4x1y/A7gl3f5uoUm X-Received: by 2002:a05:6402:387:b0:50c:2215:317e with SMTP id o7-20020a056402038700b0050c2215317emr3020056edv.15.1688199806720; Sat, 01 Jul 2023 01:23:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688199806; cv=none; d=google.com; s=arc-20160816; b=TwmEe+vwUv8csMd2Yo9Rqbd2Sai4sYCulOhJPA/ZhnZ7Mz6RCI0QwVNs4G79nNOXA2 4E7heVESWGolU2x1uy0u8iYnLtupeXI+dBh8M5AQ0X26fHi0ClYAeNTTb5tgJOx1gOwR /xuuqdUV2rtgIEQWHfNThImSRImyQb69MUHUFxrC3lSAys7khgJVsInUsipuJjOyD3ei zP7En08cezJuwTlLi0UA9ng1CT/U7lbnToskLT+WfVTc3SyygOuFaDN1gPcU3Xn7yA+V c+1NDD1z9svkerETGbfWXjL8OV2yPjLnFdKVfvlJ3nWGNpgDfK4JgsEBk15DxLsxx+ZS j1DA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:dmarc-filter:delivered-to :dkim-signature:dkim-filter; bh=hYd+u3HUNIrdPmAf6OtFTUpjvJl7fIfnfr0cN0ao6Xw=; fh=XbcmRug6/SzczusyoNU1I7Lu5oY0AN2u0mWDzKoxdSs=; b=SOfGHC1v+AVOmdZJdM38mPaafPyMLCUhgL9yzXZ5IVYJkqwkeoT78GU+zO3vMe8lde UWSd1J6+ZmBf0el2g+rY1bZPy+6IvtVc8WysTSLmAJKp1ne6TQWye2ktplQedXbo0Fa1 mkrzjZX8DvbDAJxbRsoWAYkhEq2DOCIceH7rOK12yBHf7xJ9Qo0LgStZHyc30dj3OCTs I5zSLK/oBEpxB7qifC+6AtUycLnFBqudhwBrb5rH+8vJonQCpDREHdGZCF6dNpMq+1BI QI/fhv0lJxbBd77R1fPEfNlFRMwflJ+9lkGJgf7P/5FbTq9zpjhDDYzR/pp0hfNX2BpX w5BA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=hBDP4kQT; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from sourceware.org (ip-8-43-85-97.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id d7-20020a50fe87000000b0051a48e2d185si7797487edt.286.2023.07.01.01.23.26 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 01 Jul 2023 01:23:26 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=hBDP4kQT; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 815F33858433 for ; Sat, 1 Jul 2023 08:23:22 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 815F33858433 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1688199802; bh=hYd+u3HUNIrdPmAf6OtFTUpjvJl7fIfnfr0cN0ao6Xw=; h=To:CC:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=hBDP4kQTT9Wnu+MmLtJBhlPhNUHdfBGKyBKT7GB0lwMW6GksrnJbhuFApiQx+FtC0 dHQIu3Z1tJjVZg440g1ELwRmdTTq2wDLj/xmbUc6/5IlzwbR9EPAcamrzuHkG5ws8F VxYqxYjUPAs5STLuAfpquPxNBfMH6lAWLRZczWyM= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by sourceware.org (Postfix) with ESMTPS id A7B5F3858D37 for ; Sat, 1 Jul 2023 08:22:29 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A7B5F3858D37 Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3617U8cG031331 for ; Sat, 1 Jul 2023 01:22:29 -0700 Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3rj8hg11p3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Sat, 01 Jul 2023 01:22:29 -0700 Received: from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Sat, 1 Jul 2023 01:22:26 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server id 15.0.1497.48 via Frontend Transport; Sat, 1 Jul 2023 01:22:26 -0700 Received: from vpnclient.wrightpinski.org.com (unknown [10.69.242.187]) by maili.marvell.com (Postfix) with ESMTP id F3F2A3F707D; Sat, 1 Jul 2023 01:22:25 -0700 (PDT) To: CC: Andrew Pinski Subject: [PATCH 2/2] PR 110487: `(a !=/== CST1 ? CST2 : CST3)` pattern for type safety Date: Sat, 1 Jul 2023 01:22:16 -0700 Message-ID: <20230701082216.299104-2-apinski@marvell.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20230701082216.299104-1-apinski@marvell.com> References: <20230701082216.299104-1-apinski@marvell.com> MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: KG6dur6agnydkpqOJqzGzfyYtiHJXgkL X-Proofpoint-GUID: KG6dur6agnydkpqOJqzGzfyYtiHJXgkL X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-07-01_06,2023-06-30_01,2023-05-22_02 X-Spam-Status: No, score=-14.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, PLING_QUERY, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Andrew Pinski via Gcc-patches From: Andrew Pinski Reply-To: Andrew Pinski Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1770205800369501187?= X-GMAIL-MSGID: =?utf-8?q?1770205800369501187?= The problem here is we might produce some values out of the type's min/max (and/or valid values, e.g. signed booleans). The fix is to use an integer type which has the same precision and signedness as the original type. Note two_value_replacement in phiopt had the same issue in previous versions; though I don't know if a problem will show up there. OK? Bootstrapped and tested on x86_64-linux-gnu. gcc/ChangeLog: PR tree-optimization/110487 * match.pd (a !=/== CST1 ? CST2 : CST3): Always build a nonstandard integer and use that. --- gcc/match.pd | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/gcc/match.pd b/gcc/match.pd index a0d114f6a16..9748ad8466e 100644 --- a/gcc/match.pd +++ b/gcc/match.pd @@ -4797,24 +4797,16 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT) tree type1; if ((eqne == EQ_EXPR) ^ (wi::to_wide (@1) == min)) std::swap (arg0, arg1); - if (TYPE_PRECISION (TREE_TYPE (@0)) == TYPE_PRECISION (type)) - { - /* Avoid performing the arithmetics in bool type which has different - semantics, otherwise prefer unsigned types from the two with - the same precision. */ - if (TREE_CODE (TREE_TYPE (arg0)) == BOOLEAN_TYPE - || !TYPE_UNSIGNED (type)) - type1 = TREE_TYPE (@0); - else - type1 = TREE_TYPE (arg0); - } - else if (TYPE_PRECISION (TREE_TYPE (@0)) > TYPE_PRECISION (type)) + if (TYPE_PRECISION (TREE_TYPE (@0)) > TYPE_PRECISION (type)) type1 = TREE_TYPE (@0); else type1 = type; - min = wide_int::from (min, TYPE_PRECISION (type1), + auto prec = TYPE_PRECISION (type1); + auto unsign = TYPE_UNSIGNED (type1); + type1 = build_nonstandard_integer_type (prec, unsign); + min = wide_int::from (min, prec, TYPE_SIGN (TREE_TYPE (@0))); - wide_int a = wide_int::from (wi::to_wide (arg0), TYPE_PRECISION (type1), + wide_int a = wide_int::from (wi::to_wide (arg0), prec, TYPE_SIGN (type)); enum tree_code code; wi::overflow_type ovf; @@ -4822,7 +4814,7 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT) { code = PLUS_EXPR; a -= min; - if (!TYPE_UNSIGNED (type1)) + if (!unsign) { /* lhs is known to be in range [min, min+1] and we want to add a to it. Check if that operation can overflow for those 2 values @@ -4836,7 +4828,7 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT) { code = MINUS_EXPR; a += min; - if (!TYPE_UNSIGNED (type1)) + if (!unsign) { /* lhs is known to be in range [min, min+1] and we want to subtract it from a. Check if that operation can overflow for those 2