You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am also having trouble getting abseil-duration-factory-scale.cpp check on 32bit fail.
I tracked this down to clang-tidy/abseil/DurationFactoryScaleCheck.cpp:getNewScale()
comparing double float value to 1.0,
but 0.001 * 1000 doesn't equal 1.0 due to precision.
Following patch seems to fix this.
I don't know why x86_64 is working without this kind of patch.
Subject: fuzzy match double Multiplier == 1.0 in DurationFactoryScaleCheck.cpp
From: <kabe@>
Replace double comparison d == 1.0 with fuzzy match std::abs(d - 1.0) < 1e-14.
1e-14 is an arbitary epsilon.
Without this patch, clang-tidy did not downshift
d = absl::Seconds(1e-3 * 30);
to
d = absl::Milliseconds(30);
diff -up ./clang-tools-extra-13.0.1.src/clang-tidy/abseil/DurationFactoryScaleCheck.cpp.t64 ./clang-tools-extra-13.0.1.src/clang-tidy/abseil/DurationFactoryScaleCheck.cpp
--- ./clang-tools-extra-13.0.1.src/clang-tidy/abseil/DurationFactoryScaleCheck.cpp.t64 2022-01-21 06:31:59.000000000 +0900
+++ ./clang-tools-extra-13.0.1.src/clang-tidy/abseil/DurationFactoryScaleCheck.cpp 2022-10-11 22:27:36.694627456 +0900
@@ -96,12 +96,15 @@ getNewScaleSingleStep(DurationScale OldS
// would produce a new scale. If so, return it, otherwise `None`.
static llvm::Optional<DurationScale> getNewScale(DurationScale OldScale,
double Multiplier) {
- while (Multiplier != 1.0) {
+ //while (Multiplier != 1.0)
+ while (std::abs(Multiplier - 1.0) > 1e-14) {
llvm::Optional<std::tuple<DurationScale, double>> Result =
getNewScaleSingleStep(OldScale, Multiplier);
if (!Result)
break;
- if (std::get<1>(*Result) == 1.0)
+ //if (std::get<1>(*Result) == 1.0)
+ //Above does not work properly when shifting up 0.001 to 1.0
+ if (std::abs(std::get<1>(*Result) - 1.0) < 1e-14)
return std::get<0>(*Result);
Multiplier = std::get<1>(*Result);
OldScale = std::get<0>(*Result);
Extended Description
The clang-tidy testsuite fails on 32-bit IA32 for abseil-duration-factory-scale:
Failing Tests (1):
Clang Tools :: clang-tidy/abseil-duration-factory-scale.cpp
Expected Passes : 1126
Expected Failures : 1
Unsupported Tests : 3
Unexpected Failures: 1
FAILED: tools/extra/test/CMakeFiles/check-clang-tools
cd /build/clang/src/cfe-8.0.0.src/build/tools/extra/test && /usr/bin/python /usr/bin/lit -sv /build/clang/src/cfe-8.0.0.src/build/tools/extra/test
ninja: build stopped: subcommand failed.
The full build log is attached.
The text was updated successfully, but these errors were encountered: