From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1666) id 6C0A53858D20; Fri, 23 Jun 2023 09:24:11 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6C0A53858D20 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1687512251; bh=aGztrDDxV10HKRUQwixdEAgqdN+qy4IOFbNzKGZ39ys=; h=From:To:Subject:Date:From; b=vrAQSRNROAK4AamnflIixUdjLmQALjq/q4EYc+dtZxuLfKF7v4OQU924EHYR6yKaX XSkx+UcN/QndqVNEC7uo1Tynfpu82DkEUIuXLU7/v40h+LBoADY1YfmE7CAigAwnZk H4T/WYHXJVorXfFF4PexCun2YIx8w+MlYP+cL078= 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-2043] Fix tree_simple_nonnegative_warnv_p for VECTOR_TYPEs X-Act-Checkin: gcc X-Git-Author: Richard Biener X-Git-Refname: refs/heads/master X-Git-Oldrev: 4127e0f3313c961b4b4e5efad85a25c40c2510c2 X-Git-Newrev: 4f2fcf21d4c939831c299cb884cbeaca1d33fa8e Message-Id: <20230623092411.6C0A53858D20@sourceware.org> Date: Fri, 23 Jun 2023 09:24:11 +0000 (GMT) List-Id: https://gcc.gnu.org/g:4f2fcf21d4c939831c299cb884cbeaca1d33fa8e commit r14-2043-g4f2fcf21d4c939831c299cb884cbeaca1d33fa8e Author: Richard Biener Date: Fri Jun 23 10:12:24 2023 +0200 Fix tree_simple_nonnegative_warnv_p for VECTOR_TYPEs tree_simple_nonnegative_warnv_p ends up being called on VECTOR_TYPEs which I think even gets the wrong answer here for tcc_comparison since vector bools are signed. The following properly guards that with !VECTOR_TYPE_P. * fold-const.cc (tree_simple_nonnegative_warnv_p): Guard the truth_value_p case with !VECTOR_TYPE_P. Diff: --- gcc/fold-const.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gcc/fold-const.cc b/gcc/fold-const.cc index b05b3ae16e9..ac90a594fcc 100644 --- a/gcc/fold-const.cc +++ b/gcc/fold-const.cc @@ -14530,7 +14530,8 @@ tree_expr_maybe_real_minus_zero_p (const_tree x) static bool tree_simple_nonnegative_warnv_p (enum tree_code code, tree type) { - if ((TYPE_PRECISION (type) != 1 || TYPE_UNSIGNED (type)) + if (!VECTOR_TYPE_P (type) + && (TYPE_PRECISION (type) != 1 || TYPE_UNSIGNED (type)) && truth_value_p (code)) /* Truth values evaluate to 0 or 1, which is nonnegative unless we have a signed:1 type (where the value is -1 and 0). */