Commit 49c3864b authored by Sven Panne's avatar Sven Panne

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}
parent 00f43504
...@@ -337,6 +337,9 @@ std::ostream& operator<<(std::ostream& os, ...@@ -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) { std::ostream& operator<<(std::ostream& os, const Constant& constant) {
switch (constant.type()) { switch (constant.type()) {
case Constant::kInt32: case Constant::kInt32:
......
...@@ -737,7 +737,7 @@ class Constant FINAL { ...@@ -737,7 +737,7 @@ class Constant FINAL {
kRpoNumber 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(int64_t v) : type_(kInt64), value_(v) {}
explicit Constant(float v) : type_(kFloat32), value_(bit_cast<int32_t>(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)) {} explicit Constant(double v) : type_(kFloat64), value_(bit_cast<int64_t>(v)) {}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment