CI updates

This commit is contained in:
Markus F.X.J. Oberhumer
2024-04-20 12:29:32 +02:00
parent 1d2b276425
commit e4de14612f
9 changed files with 22 additions and 34 deletions
+7 -23
View File
@@ -370,28 +370,6 @@ static noinline double u64_f64_sub_div(upx_uint64_t a, upx_uint64_t b) {
return (a - b) / 1000000.0;
}
// extra debugging; floating point edge cases cause portability problems in practice
static noinline bool shall_test_float_division_by_zero(void) {
static bool result = false; // default is false
static upx_std_once_flag init_done;
upx_std_call_once(init_done, []() noexcept {
static const char envvar[] = "UPX_DEBUG_TEST_FLOAT_DIVISION_BY_ZERO";
const char *e = upx_getenv(envvar);
bool force = (e && e[0] && strcmp(e, "2") == 0);
if (force)
result = true;
else if (is_envvar_true(envvar)) {
#if defined(__clang__) && defined(__FAST_MATH__) && defined(__INTEL_LLVM_COMPILER)
// warning: comparison with NaN always evaluates to false in fast floating point modes
fprintf(stderr, "upx: WARNING: ignoring %s: __FAST_MATH__\n", envvar);
#else
result = true;
#endif
}
});
return result;
}
template <class Int, class Float>
struct TestFloat {
static constexpr Int X = 1000000;
@@ -407,10 +385,16 @@ struct TestFloat {
assert_noexcept(sub_div(3 * X, X, Float(X)) == Float(2));
assert_noexcept(sub_div_x(3 * X, X) == Float(2));
// extra debugging; floating point edge cases cause portability problems in practice
if (shall_test_float_division_by_zero()) {
static const char envvar[] = "UPX_DEBUG_TEST_FLOAT_DIVISION_BY_ZERO";
if (is_envvar_true(envvar)) {
#if defined(__FAST_MATH__)
// warning: comparison with NaN always evaluates to false in fast floating point modes
fprintf(stderr, "upx: WARNING: ignoring %s: __FAST_MATH__\n", envvar);
#else
assert_noexcept(std::isnan(div(0, Float(0))));
assert_noexcept(std::isinf(div(1, Float(0))));
assert_noexcept(std::isinf(div(Int(-1), Float(0))));
#endif
}
}
};
+7 -3
View File
@@ -364,11 +364,15 @@ struct TestTriBool {
static_assert(std::is_trivially_copyable<T>::value);
static_assert(sizeof(typename T::value_type) == sizeof(typename T::underlying_type));
static_assert(alignof(typename T::value_type) == alignof(typename T::underlying_type));
#if (ACC_ARCH_M68K && ACC_OS_TOS && ACC_CC_GNUC) && defined(__MINT__)
#if defined(__m68k__) && defined(__atarist__) && defined(__GNUC__)
// broken compiler or broken ABI
#elif __GNUC__ == 7 && defined(__i386__) && !defined(__clang__)
#elif defined(__i386__) && defined(__clang__) && (__clang_major__ < 9)
static_assert(sizeof(T) == sizeof(typename T::underlying_type));
// gcc-7 "long long" enum align bug/ABI problem on i386
// i386: "long long" enum align bug/ABI problem on older compilers
static_assert(alignof(T) <= alignof(typename T::underlying_type));
#elif defined(__i386__) && defined(__GNUC__) && (__GNUC__ == 7) && !defined(__clang__)
static_assert(sizeof(T) == sizeof(typename T::underlying_type));
// i386: "long long" enum align bug/ABI problem on older compilers
static_assert(alignof(T) <= alignof(typename T::underlying_type));
#else
static_assert(sizeof(T) == sizeof(typename T::underlying_type));
+1 -1
View File
@@ -55,7 +55,7 @@
#endif
#endif
#if defined(__clang__) && defined(__FAST_MATH__) && defined(__INTEL_LLVM_COMPILER)
#if defined(__clang__) && defined(__FAST_MATH__)
// warning: comparison with NaN always evaluates to false in fast floating point modes
#pragma clang diagnostic ignored "-Wtautological-constant-compare"
#endif