From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1314) id 2A83F385456B; Thu, 17 Nov 2022 17:59:52 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2A83F385456B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1668707992; bh=TjomgVSRLoyHvFDyHmwlGq8liqchMX6AejTh4M8SeHs=; h=From:To:Subject:Date:From; b=yFf5Y6FwDMkuui1zR6XQ+h9E/pzcadKb/zsAWAvDzM03Qd1o8gVB27jd6/Ud9JJQ7 RIVnBcKqbc8+zacnW29qPcK+H3SAN/gwlD/6WGzWJ67s+Ipszc3LqKwWrsFmRO+f6S yIARhyQzd+iyYTbH34mC8uEplkYjlg93+5ydVGZQ= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Andrew Pinski To: gcc-cvs@gcc.gnu.org Subject: [gcc r13-4132] Fix PR 107734: valgrind errors with sbitmap in match.pd X-Act-Checkin: gcc X-Git-Author: Andrew Pinski X-Git-Refname: refs/heads/trunk X-Git-Oldrev: 4e306222f442f8d4c6fc6da997ab756a5e43e36e X-Git-Newrev: ee892832ea19b21a3420ef042e582204fac852a2 Message-Id: <20221117175952.2A83F385456B@sourceware.org> Date: Thu, 17 Nov 2022 17:59:52 +0000 (GMT) List-Id: https://gcc.gnu.org/g:ee892832ea19b21a3420ef042e582204fac852a2 commit r13-4132-gee892832ea19b21a3420ef042e582204fac852a2 Author: Andrew Pinski Date: Thu Nov 17 17:48:00 2022 +0000 Fix PR 107734: valgrind errors with sbitmap in match.pd 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. Diff: --- 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++)