diff options
Diffstat (limited to 'gnu/llvm/lib/Support/JSON.cpp')
| -rw-r--r-- | gnu/llvm/lib/Support/JSON.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/gnu/llvm/lib/Support/JSON.cpp b/gnu/llvm/lib/Support/JSON.cpp index a5dae7a7c2e..07a55681491 100644 --- a/gnu/llvm/lib/Support/JSON.cpp +++ b/gnu/llvm/lib/Support/JSON.cpp @@ -182,6 +182,12 @@ bool operator==(const Value &L, const Value &R) { case Value::Boolean: return *L.getAsBoolean() == *R.getAsBoolean(); case Value::Number: + // Workaround for https://gcc.gnu.org/bugzilla/show_bug.cgi?id=323 + // The same integer must convert to the same double, per the standard. + // However we see 64-vs-80-bit precision comparisons with gcc-7 -O3 -m32. + // So we avoid floating point promotion for exact comparisons. + if (L.Type == Value::T_Integer || R.Type == Value::T_Integer) + return L.getAsInteger() == R.getAsInteger(); return *L.getAsNumber() == *R.getAsNumber(); case Value::String: return *L.getAsString() == *R.getAsString(); @@ -517,7 +523,7 @@ static std::vector<const Object::value_type *> sortedElements(const Object &O) { std::vector<const Object::value_type *> Elements; for (const auto &E : O) Elements.push_back(&E); - llvm::sort(Elements.begin(), Elements.end(), + llvm::sort(Elements, [](const Object::value_type *L, const Object::value_type *R) { return L->first < R->first; }); |
