aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2021-05-06 10:45:19 +0200
committerUlf Hermann <ulf.hermann@qt.io>2021-05-06 10:56:14 +0200
commit3a8c0fd5cb9bfec439c306593bce19f434c871ce (patch)
tree3f4c597e689af20d832b9c3507ba8d641c32e252 /src/qml/jsruntime
parent1e40a1c6822cd3387242854f81ea502b9b261b1c (diff)
Workaround mingw compiler bug
std::acosh(v) wrongly returns NaN for v == Inf on mingw. This makes the ecmascript tests fail. Fixes: QTBUG-93175 Pick-to: 6.0 6.1 Change-Id: Ic6677b3259dad591b946b23d4d6a6859f6e70b0f Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Maximilian Goldstein <max.goldstein@qt.io> Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Diffstat (limited to 'src/qml/jsruntime')
-rw-r--r--src/qml/jsruntime/qv4mathobject.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/qml/jsruntime/qv4mathobject.cpp b/src/qml/jsruntime/qv4mathobject.cpp
index 8627c0a5af..afe5c31db3 100644
--- a/src/qml/jsruntime/qv4mathobject.cpp
+++ b/src/qml/jsruntime/qv4mathobject.cpp
@@ -148,6 +148,11 @@ ReturnedValue MathObject::method_acosh(const FunctionObject *, const Value *, co
#ifdef Q_OS_ANDROID // incomplete std :-(
RETURN_RESULT(Encode(std::log(v +std::sqrt(v + 1) * std::sqrt(v - 1))));
#else
+#ifdef Q_CC_MINGW
+ // Mingw has a broken std::acosh(). It returns NaN when passed Infinity.
+ if (std::isinf(v))
+ RETURN_RESULT(Encode(v));
+#endif
RETURN_RESULT(Encode(std::acosh(v)));
#endif
}