summaryrefslogtreecommitdiff
path: root/include/llvm/ADT/BitVector.h
diff options
context:
space:
mode:
authorOwen Anderson <resistor@mac.com>2007-07-09 23:39:39 +0000
committerOwen Anderson <resistor@mac.com>2007-07-09 23:39:39 +0000
commit0c81450a0c1f859738a2f209a89de10f889fcd84 (patch)
tree99b726d98d2f4a21f79d878cc3615d1f8e00b787 /include/llvm/ADT/BitVector.h
parentdfa24357840e191e9f69a803b6b14ef1032a26b4 (diff)
downloadllvm-0c81450a0c1f859738a2f209a89de10f889fcd84.tar.gz
llvm-0c81450a0c1f859738a2f209a89de10f889fcd84.tar.bz2
llvm-0c81450a0c1f859738a2f209a89de10f889fcd84.tar.xz
When resizing a BitVector with size 0, be sure to clear the low word before using it.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@38476 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/ADT/BitVector.h')
-rw-r--r--include/llvm/ADT/BitVector.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/include/llvm/ADT/BitVector.h b/include/llvm/ADT/BitVector.h
index 6418f7f66b..5247756618 100644
--- a/include/llvm/ADT/BitVector.h
+++ b/include/llvm/ADT/BitVector.h
@@ -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();
}