aboutsummaryrefslogtreecommitdiff
path: root/lib/Target
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2014-02-05 19:18:14 -0500
committerAlon Zakai <alonzakai@gmail.com>2014-02-05 19:18:14 -0500
commit4a3d10c6d7faac653b6bff61ab6fcd863dfb3864 (patch)
tree0f09dab3a95263d5a94b0dd54986b71e5102ba6f /lib/Target
parent0cfd09780a4b4eff3a19a702c746579523ab8671 (diff)
handle double strings with an uneven number of chars
Diffstat (limited to 'lib/Target')
-rw-r--r--lib/Target/JSBackend/JSBackend.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/Target/JSBackend/JSBackend.cpp b/lib/Target/JSBackend/JSBackend.cpp
index b14172abe6..82769e6370 100644
--- a/lib/Target/JSBackend/JSBackend.cpp
+++ b/lib/Target/JSBackend/JSBackend.cpp
@@ -823,7 +823,12 @@ static inline std::string ftostr_exact(const ConstantFP *CFP) {
if (raw[1] != 'x') return raw; // number has already been printed out
raw += 2; // skip "0x"
unsigned len = strlen(raw);
- assert((len&1) == 0); // must be complete bytes, so an even number of chars
+ if (len&1) {
+ // uneven, need to add a 0 to make it be entire bytes
+ temp = std::string("0") + raw;
+ raw = temp.c_str();
+ len++;
+ }
unsigned missing = 8 - len/2;
union dbl { double d; unsigned char b[sizeof(double)]; } dbl;
dbl.d = 0;