Bug fix: bm_equal() now also works if the first argument contains one or more bitmap structures that are entirely zero.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8025 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/exp-drd/drd_bitmap.c b/exp-drd/drd_bitmap.c
index 0927ea2..031337e 100644
--- a/exp-drd/drd_bitmap.c
+++ b/exp-drd/drd_bitmap.c
@@ -231,6 +231,12 @@
     bm_access_range(bm, a1, a1 + 8, eLoad);
 }
 
+void bm_access_range_store(struct bitmap* const bm,
+                           const Addr a1, const Addr a2)
+{
+  bm_access_range(bm, a1, a2, eStore);
+}
+
 void bm_access_store_1(struct bitmap* const bm, const Addr a1)
 {
   bm_access_aligned_store(bm, a1, 1);
@@ -265,12 +271,6 @@
     bm_access_range(bm, a1, a1 + 8, eStore);
 }
 
-void bm_access_range_store(struct bitmap* const bm,
-                           const Addr a1, const Addr a2)
-{
-  bm_access_range(bm, a1, a2, eStore);
-}
-
 Bool bm_has(const struct bitmap* const bm, const Addr a1, const Addr a2,
             const BmAccessTypeT access_type)
 {
@@ -769,11 +769,18 @@
 
   for ( ; (bm2l_ref = VG_(OSetGen_Next)(lhs->oset)) != 0; )
   {
-    bm2l = bm2l_ref->bm2;
+    while (bm2l_ref
+           && (bm2l = bm2l_ref->bm2)
+           && bm2l
+           && ! bm_has_any_access(lhs,
+                                  bm2l->addr << ADDR0_BITS,
+                                  (bm2l->addr + 1) << ADDR0_BITS))
+    {
+      bm2l_ref = VG_(OSetGen_Next)(lhs->oset);
+    }
+    if (bm2l_ref == 0)
+      break;
     tl_assert(bm2l);
-    tl_assert(bm_has_any_access(lhs,
-                                bm2l->addr << ADDR0_BITS,
-                                (bm2l->addr + 1) << ADDR0_BITS));
 #if 0
     VG_(message)(Vg_DebugMsg, "bm_equal: at 0x%lx", bm2l->addr << ADDR0_BITS);
 #endif