diff options
author | Reid Spencer <rspencer@reidspencer.com> | 2007-01-18 18:01:32 +0000 |
---|---|---|
committer | Reid Spencer <rspencer@reidspencer.com> | 2007-01-18 18:01:32 +0000 |
commit | 8205972a5a62a9e80c4772bf7ba3197a125c12f1 (patch) | |
tree | b86236544be7473df50a54f5924f6bd2c80e0464 /lib/ExecutionEngine/ExecutionEngine.cpp | |
parent | afd7a08a76a13bfc379702e6c07fc76c1fdbf7c5 (diff) |
Fix a regression in the last patch. When constructing a BitMask, be careful
not to overflow 64-bits and end up with a 0 mask. This caused i64 values to
always be stored as 0 with lots of consequential damage to nightly test.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33335 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/ExecutionEngine/ExecutionEngine.cpp')
-rw-r--r-- | lib/ExecutionEngine/ExecutionEngine.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/ExecutionEngine/ExecutionEngine.cpp b/lib/ExecutionEngine/ExecutionEngine.cpp index 2cb4a8ef96..771ce0b1aa 100644 --- a/lib/ExecutionEngine/ExecutionEngine.cpp +++ b/lib/ExecutionEngine/ExecutionEngine.cpp @@ -457,6 +457,8 @@ void ExecutionEngine::StoreValueToMemory(GenericValue Val, GenericValue *Ptr, case Type::IntegerTyID: { unsigned BitWidth = cast<IntegerType>(Ty)->getBitWidth(); uint64_t BitMask = (1ull << BitWidth) - 1; + if (BitWidth >= 64) + BitMask = (uint64_t)-1; GenericValue TmpVal = Val; if (BitWidth <= 8) Ptr->Untyped[0] = Val.Int8Val & BitMask; @@ -513,6 +515,8 @@ Store4BytesLittleEndian: case Type::IntegerTyID: { unsigned BitWidth = cast<IntegerType>(Ty)->getBitWidth(); uint64_t BitMask = (1ull << BitWidth) - 1; + if (BitWidth >= 64) + BitMask = (uint64_t)-1; GenericValue TmpVal = Val; if (BitWidth <= 8) Ptr->Untyped[0] = Val.Int8Val & BitMask; |