Added a workaround for undefined behavior.

Note that this patch is not really a *solution*, it is just enough to
make the undefined behavior unobservable. The real fix would be being
much more correct about sizes and signedness in our code base...

BUG=chromium:464657
LOG=n
R=dcarney@chromium.org

Review URL: https://codereview.chromium.org/995743002

Cr-Commit-Position: refs/heads/master@{#27100}
This commit is contained in:
Sven Panne 2015-03-10 13:12:41 +01:00
parent 00f4350403
commit 49c3864b4b
2 changed files with 4 additions and 1 deletions

View File

@ -337,6 +337,9 @@ std::ostream& operator<<(std::ostream& os,
}
Constant::Constant(int32_t v) : type_(kInt32), value_(v) {}
std::ostream& operator<<(std::ostream& os, const Constant& constant) {
switch (constant.type()) {
case Constant::kInt32:

View File

@ -737,7 +737,7 @@ class Constant FINAL {
kRpoNumber
};
explicit Constant(int32_t v) : type_(kInt32), value_(v) {}
explicit Constant(int32_t v);
explicit Constant(int64_t v) : type_(kInt64), value_(v) {}
explicit Constant(float v) : type_(kFloat32), value_(bit_cast<int32_t>(v)) {}
explicit Constant(double v) : type_(kFloat64), value_(bit_cast<int64_t>(v)) {}