summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorTatiana Borisova <tatiana.borisova@qt.io>2021-12-03 16:03:10 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2021-12-06 18:58:08 +0000
commit5b8ff45dd9b9282936d5ffdf6e42dc4316038a17 (patch)
tree967332cbc288fc1734b1efc9a88c33ffdacf1516 /tests
parent8d74dd234a37047a81d5426d20348c98c2299858 (diff)
Fix tst_qfloat16 runtime failure for INTEGRITY
- GHS compiler is not fully compliant with iec559. Therefore we need to update is_iec559 checking for GHS case. Change-Id: Ia094509d26bf5f0109f2937547a056267019cffb Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Janne Koskinen <janne.p.koskinen@qt.io> (cherry picked from commit eba9196304dcc9129a7bb68db87c6fb42c953090) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/corelib/global/qfloat16/tst_qfloat16.cpp13
1 files changed, 13 insertions, 0 deletions
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);