summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/corelib/global/qglobal.cpp2
-rw-r--r--tests/auto/corelib/global/qfloat16/tst_qfloat16.cpp13
2 files changed, 14 insertions, 1 deletions
diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp
index 45dfe21842..7cb472a6b5 100644
--- a/src/corelib/global/qglobal.cpp
+++ b/src/corelib/global/qglobal.cpp
@@ -150,7 +150,7 @@ static_assert(sizeof(wchar_t) == sizeof(char32_t) || sizeof(wchar_t) == sizeof(c
// denormals where GHS compiler is relying hardware behavior that is not IEC
// 559 compliant. So split the check in several subchecks.
-// On GHC the compiler reports std::numeric_limits<float>::is_iec559 as false.
+// On GHS the compiler reports std::numeric_limits<float>::is_iec559 as false.
// This is all right according to our needs.
#if !defined(Q_CC_GHS)
static_assert(std::numeric_limits<float>::is_iec559,
diff --git a/tests/auto/corelib/global/qfloat16/tst_qfloat16.cpp b/tests/auto/corelib/global/qfloat16/tst_qfloat16.cpp
index 35d7dbccf0..90e131a7ef 100644
--- a/tests/auto/corelib/global/qfloat16/tst_qfloat16.cpp
+++ b/tests/auto/corelib/global/qfloat16/tst_qfloat16.cpp
@@ -540,7 +540,20 @@ void tst_qfloat16::properties()
QVERIFY(Bounds::is_signed);
QVERIFY(!Bounds::is_integer);
QVERIFY(!Bounds::is_exact);
+
+ // While we'd like to check for __STDC_IEC_559__, as per ISO/IEC 9899:2011
+ // Annex F (C11, normative for C++11), there are a few corner cases regarding
+ // denormals where GHS compiler is relying hardware behavior that is not IEC
+ // 559 compliant.
+
+ // On GHS the compiler reports std::numeric_limits<float>::is_iec559 as false.
+ // and the same supposed to be for qfloat16.
+#if !defined(Q_CC_GHS)
QVERIFY(Bounds::is_iec559);
+#else
+ // Technically, presence of NaN and infinities are implied from the above check, but that checkings GHS compiler complies.
+ QVERIFY(Bounds::has_infinity && Bounds::has_quiet_NaN && Bounds::has_signaling_NaN);
+#endif // Q_CC_GHS
QVERIFY(Bounds::is_bounded);
QVERIFY(!Bounds::is_modulo);
QVERIFY(!Bounds::traps);