[PATCH]: bitmap_and () causing inconsistent bitmap

Seongbae Park seongbae.park@gmail.com
Mon Feb 12 06:45:00 GMT 2007


Enclosed patch fixes a bug found during testing the dataflow branch.
In bitmap_and(),
if IOR was ever 0, then dst->current
could become "stale" - that is, dst->current->indx
could be smaller than or equal to dst_elt->indx.
When this happens, bitmap_elt_clear_from () doesn't work anymore
as it assumes that bitmap is in a correct state,
leaving DST in an invalid state (e.g. first and current
pointing to different bitmap_element instances
with same INDX value).
Bootstrapped and regtested on ia64 on dataflow branch.
Unfortunately, lacking any infrastructure to add unittests
for internal datastructures, I can't create a testcase for this bug.
Ok for mainline ?


Index: bitmap.c
--- bitmap.c    (revision 121840)
+++ bitmap.c    (working copy)
@@ -797,6 +797,8 @@
          b_elt = b_elt->next;
+  /* This is to prevent stale current hanging.  */
+  dst->current = dst->first;
   bitmap_elt_clear_from (dst, dst_elt);
   gcc_assert (!dst->current == !dst->first);
   if (dst->current)
Index: ChangeLog
--- ChangeLog   (revision 121840)
+++ ChangeLog   (working copy)
@@ -1,3 +1,7 @@
+2007-02-11  Seongbae Park <seongbae.park@gmail.com>
+       * bitmap.c (bitmap_and): Prevent stale current.
 2007-02-11  Roger Sayle  <roger@eyesopen.com>
            Matt Thomas  <matt@3am-software.com>

More information about the Gcc-patches mailing list