]> gcc.gnu.org Git - gcc.git/commitdiff
Fix PR 107734: valgrind errors with sbitmap in match.pd
authorAndrew Pinski <apinski@marvell.com>
Thu, 17 Nov 2022 17:48:00 +0000 (17:48 +0000)
committerAndrew Pinski <apinski@marvell.com>
Thu, 17 Nov 2022 17:56:55 +0000 (17:56 +0000)
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

index 5aba1653b80ef429caf661e60490c28cd1aaaab3..a4d1386fd9f63b4a32142534a9b5ccfdf3784eb4 100644 (file)
@@ -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++)
This page took 0.073885 seconds and 5 git commands to generate.