[llvm-commits] CVS: llvm/lib/Bytecode/Reader/Reader.cpp

Chris Lattner lattner at cs.uiuc.edu
Sun Jul 25 16:15:54 PDT 2004



Changes in directory llvm/lib/Bytecode/Reader:

Reader.cpp updated: 1.118 -> 1.119

---
Log message:

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.


---
Diffs of the changes:  (+2 -1)

Index: llvm/lib/Bytecode/Reader/Reader.cpp
diff -u llvm/lib/Bytecode/Reader/Reader.cpp:1.118 llvm/lib/Bytecode/Reader/Reader.cpp:1.119
--- llvm/lib/Bytecode/Reader/Reader.cpp:1.118	Sun Jul 25 16:36:26 2004
+++ llvm/lib/Bytecode/Reader/Reader.cpp	Sun Jul 25 18:15:44 2004
@@ -175,7 +175,8 @@
     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);





More information about the llvm-commits mailing list