public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [COMMITTED] Fix PR 107734: valgrind errors with sbitmap in match.pd
@ 2022-11-17 17:59 apinski
  0 siblings, 0 replies; only message in thread
From: apinski @ 2022-11-17 17:59 UTC (permalink / raw)
  To: gcc-patches; +Cc: Andrew Pinski

From: Andrew Pinski <apinski@marvell.com>

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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-11-17 17:59 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-17 17:59 [COMMITTED] Fix PR 107734: valgrind errors with sbitmap in match.pd apinski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).