When resizing a BitVector with size 0, be sure to clear the low word before using it.
authorOwen Anderson <resistor@mac.com>
Mon, 9 Jul 2007 23:39:39 +0000 (23:39 +0000)
committerOwen Anderson <resistor@mac.com>
Mon, 9 Jul 2007 23:39:39 +0000 (23:39 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@38476 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/ADT/BitVector.h

index 6418f7f66b4b1c1e2da1a8b19d2153e46cd451a7..5247756618e9ae9f0d89f5141a344dd83a1b1304 100644 (file)
@@ -185,6 +185,11 @@ public:
       grow(N);
       init_words(&Bits[OldCapacity], (Capacity-OldCapacity), t);
     }
+    
+    // If we previously had no size, initialize the low word
+    if (Size == 0)
+      Bits[0] = t;
+    
     Size = N;
     clear_unused_bits();
   }