diff options
author | Richard Biener <rguenther@suse.de> | 2016-10-07 10:06:24 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2016-10-07 10:06:24 +0000 |
commit | a30fe4b68120118221578b111036fa5fea0d25b3 (patch) | |
tree | b23b27954b915b8b7d050e18c30416a85b78a564 /gcc/bitmap.h | |
parent | a93cdc5c6f1d56226c3ef7b69423a4074783de34 (diff) | |
download | gcc-a30fe4b68120118221578b111036fa5fea0d25b3.tar.gz |
bitmap.c (bitmap_elem_to_freelist): Set indx to -1.
2016-10-07 Richard Biener <rguenther@suse.de>
* bitmap.c (bitmap_elem_to_freelist): Set indx to -1.
* bitmap.h (bmp_iter_set): When advancing to the next element
check that we didn't remove the current one.
(bmp_iter_and): Likewise.
(bmp_iter_and_compl): Likewise.
* tree-ssa.c (release_defs_bitset): Do not remove worklist bit
we currently iterate on but keep a one-level queue.
* sched-deps.c (remove_from_deps): Do not clear current bit
but keep a one-level queue.
From-SVN: r240859
Diffstat (limited to 'gcc/bitmap.h')
-rw-r--r-- | gcc/bitmap.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/gcc/bitmap.h b/gcc/bitmap.h index 111571186b7..e4e80d6ce5d 100644 --- a/gcc/bitmap.h +++ b/gcc/bitmap.h @@ -618,6 +618,9 @@ bmp_iter_set (bitmap_iterator *bi, unsigned *bit_no) bi->word_no++; } + /* Make sure we didn't remove the element while iterating. */ + gcc_checking_assert (bi->elt1->indx != -1U); + /* Advance to the next element. */ bi->elt1 = bi->elt1->next; if (!bi->elt1) @@ -664,6 +667,9 @@ bmp_iter_and (bitmap_iterator *bi, unsigned *bit_no) /* Advance to the next identical element. */ do { + /* Make sure we didn't remove the element while iterating. */ + gcc_checking_assert (bi->elt1->indx != -1U); + /* Advance elt1 while it is less than elt2. We always want to advance one elt. */ do @@ -674,6 +680,9 @@ bmp_iter_and (bitmap_iterator *bi, unsigned *bit_no) } while (bi->elt1->indx < bi->elt2->indx); + /* Make sure we didn't remove the element while iterating. */ + gcc_checking_assert (bi->elt2->indx != -1U); + /* Advance elt2 to be no less than elt1. This might not advance. */ while (bi->elt2->indx < bi->elt1->indx) @@ -726,11 +735,17 @@ bmp_iter_and_compl (bitmap_iterator *bi, unsigned *bit_no) bi->word_no++; } + /* Make sure we didn't remove the element while iterating. */ + gcc_checking_assert (bi->elt1->indx != -1U); + /* Advance to the next element of elt1. */ bi->elt1 = bi->elt1->next; if (!bi->elt1) return false; + /* Make sure we didn't remove the element while iterating. */ + gcc_checking_assert (! bi->elt2 || bi->elt2->indx != -1U); + /* Advance elt2 until it is no less than elt1. */ while (bi->elt2 && bi->elt2->indx < bi->elt1->indx) bi->elt2 = bi->elt2->next; |