summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Bytecode
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
commit74635dc879b0389214158de50e3ac630e6161b63 (patch)
tree49606da06071cc1a732bd119b9e750d956e76d31 /llvm/lib/Bytecode
parent21a015c12f10823de5540373185a99b35fa5470a (diff)
downloadbcm5719-llvm-74635dc879b0389214158de50e3ac630e6161b63.tar.gz
bcm5719-llvm-74635dc879b0389214158de50e3ac630e6161b63.zip
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. llvm-svn: 15224
Diffstat (limited to 'llvm/lib/Bytecode')
-rw-r--r--llvm/lib/Bytecode/Reader/Reader.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/llvm/lib/Bytecode/Reader/Reader.cpp b/llvm/lib/Bytecode/Reader/Reader.cpp
index 8186a77b015..6da38dd6c77 100644
--- a/llvm/lib/Bytecode/Reader/Reader.cpp
+++ b/llvm/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);
OpenPOWER on IntegriCloud