aboutsummaryrefslogtreecommitdiff
path: root/lib/Bytecode/Reader/Reader.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2004-07-25 23:15:44 +0000
committerChris Lattner <sabre@nondot.org>2004-07-25 23:15:44 +0000
commit1d78516c651368b8d9e3a20f1442982c9398b5be (patch)
tree1ead5d62bb226949dfc79c223c3c6d41934b6f57 /lib/Bytecode/Reader/Reader.cpp
parenta9d790c831de8f5dd96b689e337c35153f78a7c7 (diff)
Fix a serious bug in the double constant reader. In particular, because
(At[3] << 24) is an int type and it is being coerced to uint64_t, it was getting sign extended, causing us to get FFFFFFFFxxxxxxxx constants all of the time. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15224 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Bytecode/Reader/Reader.cpp')
-rw-r--r--lib/Bytecode/Reader/Reader.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/Bytecode/Reader/Reader.cpp b/lib/Bytecode/Reader/Reader.cpp
index 8186a77b01..6da38dd6c7 100644
--- a/lib/Bytecode/Reader/Reader.cpp
+++ b/lib/Bytecode/Reader/Reader.cpp
@@ -175,7 +175,8 @@ inline void BytecodeReader::read_double(double& DoubleVal) {
double d;
uint64_t i;
} DoubleUnion;
- DoubleUnion.i = At[0] | (At[1] << 8) | (At[2] << 16) | (At[3] << 24) |
+ DoubleUnion.i = (uint64_t(At[0]) << 0) | (uint64_t(At[1]) << 8) |
+ (uint64_t(At[2]) << 16) | (uint64_t(At[3]) << 24) |
(uint64_t(At[4]) << 32) | (uint64_t(At[5]) << 40) |
(uint64_t(At[6]) << 48) | (uint64_t(At[7]) << 56);
At+=sizeof(uint64_t);