Message ID | 1667425595-2654-1-git-send-email-apinski@marvell.com |
---|---|
Headers |
Return-Path: <gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp159109wru; Wed, 2 Nov 2022 14:48:08 -0700 (PDT) X-Google-Smtp-Source: AMsMyM62yRmqLA8JGUOz+IwA74gxD09msemujyGo56HJQ/w5XRO43gAOvH7/P3274nccRoZTEhLk X-Received: by 2002:a17:907:2723:b0:7ad:e01d:1ff5 with SMTP id d3-20020a170907272300b007ade01d1ff5mr15144373ejl.368.1667425688385; Wed, 02 Nov 2022 14:48:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667425688; cv=none; d=google.com; s=arc-20160816; b=y8NdnzeDhjYBYKTCBnQC7eba6f1fGYChxdCP0TwhN/rjy/Yqlb6t8FgY5+QfFaStzv HSV87FegmmrV82bUxdjtVNUrEyWnKDjSVQfhwoTroZ2n26AUmcmxblNSwRKkiNjhunhT LqcNHFZvtN0oc7/pF9cbd7rRRLkdjTXiP6kZd/qBBc/u58Zlgn9g1vruhtbzPVOlF2Re T4YO+qjD8stYVV0bGIaHl/es7YJCG9UAbcoJM5f4qSKBbAfRwL/TCsCQL2Omn9ye0nNP xizJhfdPnqUZG3+03qti+p3yNmrqvwJ7JXbLYZm9Y4jN50o197irqM0D/7NpaNEiHcIQ kr7w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:reply-to:from:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence :mime-version:message-id:date:subject:to:dmarc-filter:delivered-to :dkim-signature:dkim-filter; bh=W4I1QSyki46yXDfREgPTBMNaRfySqFCqlRa7pqyx98k=; b=iWTjXenSmwEYUEfibRzk3s3VQBK0QpBRo1aBRJ2Jy22xLpwqj3c7kRHu/FwTcpPvUc R6vGRhLGOfrOfzgafPiMH9ZllWskpoAGTZOIJvsCUUDKxfUg17cLTvmkxBHaJ7SwomME hJoYWBMLmhbuQjNIjhQSeo3Yzlo6rOt9qSC+5cSRE+C8xWNmg0DMOPusw6Qi8nOPQFKU NBOZQyl/8gLJ3R0BjOn3g3Jr5LR9xnJxua670lGRC+PFjFhnC5uGoIKHl9TC6pE/Hop/ M0fH0IA8qloE+zMuy0o2Q+3LiIOAe4AQnhSMv4R1125Oaa95Pttygu9oaZfPedl4rtZo +h8Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=TGNJ3AlY; 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 h11-20020a170906854b00b007ac8e6a4377si13187479ejy.219.2022.11.02.14.48.08 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Nov 2022 14:48:08 -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=TGNJ3AlY; 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 530713856941 for <ouuuleilei@gmail.com>; Wed, 2 Nov 2022 21:47:49 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 530713856941 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1667425669; bh=W4I1QSyki46yXDfREgPTBMNaRfySqFCqlRa7pqyx98k=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=TGNJ3AlYzrxIf7Llu4veuCD8jTqpv+5AkU7bXRl3+YE+hnOt0Z82PBEmx+GpAYIw7 D16WVHCcE9C4gNn2lOOUEpmzwGlyaCpgj5Vkeo33LOBCDV6K6OwAvebRwDGmL+7XeL qhTM3KvUCNPKkUEotoE+BOpgJkURVJa1oG5gHDEE= 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 90B073857351 for <gcc-patches@gcc.gnu.org>; Wed, 2 Nov 2022 21:46:42 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 90B073857351 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 2A2Hbe6q027052 for <gcc-patches@gcc.gnu.org>; Wed, 2 Nov 2022 14:46:42 -0700 Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3kkw3y0w5s-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for <gcc-patches@gcc.gnu.org>; Wed, 02 Nov 2022 14:46:42 -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.18; Wed, 2 Nov 2022 14:46:39 -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.18 via Frontend Transport; Wed, 2 Nov 2022 14:46:39 -0700 Received: from linux.marvell.com (unknown [10.69.242.198]) by maili.marvell.com (Postfix) with ESMTP id ACAFA3F704B; Wed, 2 Nov 2022 14:46:39 -0700 (PDT) To: <gcc-patches@gcc.gnu.org> Subject: [PATCH 0/2] tree_nonzero_bits vs vector and complex types Date: Wed, 2 Nov 2022 14:46:33 -0700 Message-ID: <1667425595-2654-1-git-send-email-apinski@marvell.com> X-Mailer: git-send-email 1.8.3.1 MIME-Version: 1.0 Content-Type: text/plain X-Proofpoint-GUID: s9iukTnnixZoWq9EcyQHb4sBF5EhUWwd X-Proofpoint-ORIG-GUID: s9iukTnnixZoWq9EcyQHb4sBF5EhUWwd X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-11-02_15,2022-11-02_01,2022-06-22_01 X-Spam-Status: No, score=-8.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_NONE, TXREP 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 <gcc-patches.gcc.gnu.org> List-Unsubscribe: <https://gcc.gnu.org/mailman/options/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=unsubscribe> List-Archive: <https://gcc.gnu.org/pipermail/gcc-patches/> List-Post: <mailto:gcc-patches@gcc.gnu.org> List-Help: <mailto:gcc-patches-request@gcc.gnu.org?subject=help> List-Subscribe: <https://gcc.gnu.org/mailman/listinfo/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe> From: apinski--- via Gcc-patches <gcc-patches@gcc.gnu.org> Reply-To: apinski@marvell.com Cc: Andrew Pinski <apinski@marvell.com> Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" <gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org> X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1748422558324753509?= X-GMAIL-MSGID: =?utf-8?q?1748422558324753509?= |
Series |
tree_nonzero_bits vs vector and complex types
|
|
Message
Li, Pan2 via Gcc-patches
Nov. 2, 2022, 9:46 p.m. UTC
From: Andrew Pinski <apinski@marvell.com>
While looking at older unconfirmed bug reports, I noticed there was
an ubsan found issue and noticed tree_nonzero_bits was being called with
a vector type. How ubsan found it was at the end of tree_nonzero_bits,
did "return wi::shwi (-1, TYPE_PRECISION (TREE_TYPE (t)));" and
it was with a vector of 1 elements which meant precision was 0
as precision stores the log2 of the number of elements in a vector.
Anyways we want to catch these kind of errors of calling tree_nonzero_bits
with a vector or a complex type. And fix the places where it is called.
Thanks,
Andrew Pinski
Andrew Pinski (2):
Fix PR 105532: match.pd patterns calling tree_nonzero_bits with vector
types
Add assert for type on tree_nonzero_bits
gcc/fold-const.cc | 3 +++
gcc/match.pd | 25 +++++++++++--------
.../gcc.c-torture/compile/vector-shift-1.c | 8 ++++++
3 files changed, 25 insertions(+), 11 deletions(-)
create mode 100644 gcc/testsuite/gcc.c-torture/compile/vector-shift-1.c