aboutsummaryrefslogtreecommitdiff
path: root/gcc/bitmap.h
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/bitmap.h')
-rw-r--r--gcc/bitmap.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/gcc/bitmap.h b/gcc/bitmap.h
index 1115711..e4e80d6 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;