From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by sourceware.org (Postfix) with ESMTPS id AEE313854567 for ; Thu, 17 Nov 2022 17:59:26 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org AEE313854567 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=marvell.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=marvell.com 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 2AHHbhFv001829 for ; Thu, 17 Nov 2022 09:59:25 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : mime-version : content-type; s=pfpt0220; bh=Xkx/YgPpZMES7muhhT7Zi3n+GmVhIMMdQ8AA4dtJ5Ck=; b=OqAk1VUqyguU+zIiqOmBQG/qtnOKPSxHepst0PvwgkP1a1qENPfJCmI6ascjPr226dwu Ihp+SWuNDBJY+sL/cv1THVFviNT/NJ82rTmkq2G5KAng5perfdWMBJdiSlKnWbfCupVI tSw/mGDr5q6QL0W2n2tJtHZcmS/Y+RrK5XsNGAmOXLlhpOCXO6wCicmpjpXFyPHexsCd T8gFXOziWYCDAFz+qIRNuiU/A+qZA+r0UAUir9xvH6t91f1F9HKAh6ouhuQaic4E8FIn b6/zCAgaaLFpwZDPjWO2ZgJPdn/vKY2OHt+3SOg2iMn9CgjvqOjYAEUM47L/58Z3ybNr Bg== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3kwg2cadh7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Thu, 17 Nov 2022 09:59:25 -0800 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Thu, 17 Nov 2022 09:59:23 -0800 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.2 via Frontend Transport; Thu, 17 Nov 2022 09:59:23 -0800 Received: from linux.wrightpinski.org.com (unknown [10.69.242.198]) by maili.marvell.com (Postfix) with ESMTP id 9BEC03F7040; Thu, 17 Nov 2022 09:59:23 -0800 (PST) From: To: CC: Andrew Pinski Subject: [COMMITTED] Fix PR 107734: valgrind errors with sbitmap in match.pd Date: Thu, 17 Nov 2022 09:59:18 -0800 Message-ID: <1668707958-10346-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-ORIG-GUID: 8I3hkfIG32se4eiXxw3hHrWGA5Eu3r37 X-Proofpoint-GUID: 8I3hkfIG32se4eiXxw3hHrWGA5Eu3r37 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-11-17_06,2022-11-17_01,2022-06-22_01 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,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 List-Id: From: Andrew Pinski sbitmap is a simple bitmap and the memory allocated is not cleared on creation; you have to clear it or set it to all ones before using it. This is unlike bitmap which is a sparse bitmap and the entries are cleared as created. The code added in r13-4044-gdc95e1e9702f2f missed that. This patch fixes that mistake. Committed as obvious after a bootstrap and test on x86_64-linux-gnu. gcc/ChangeLog: PR middle-end/107734 * match.pd (perm + vector op pattern): Clear the sbitmap before use. --- gcc/match.pd | 2 ++ 1 file changed, 2 insertions(+) diff --git a/gcc/match.pd b/gcc/match.pd index 5aba1653b80..a4d1386fd9f 100644 --- a/gcc/match.pd +++ b/gcc/match.pd @@ -8288,6 +8288,8 @@ and, if (sel.encoding ().encoded_full_vector_p ()) { auto_sbitmap seen (nelts); + bitmap_clear (seen); + unsigned HOST_WIDE_INT count = 0, i; for (i = 0; i < nelts; i++) -- 2.17.1