Skip to content

Commit e19738d

Browse files
MeinersburHugoSilvaSantos
authored andcommitted
[flang-rt] Use std::numeric_limits::infinity (#178166)
#175373 introduces a divide-by-zero to create an infinity value, which is undefined behavior in C++ (C++20 [expr.mul] §4), even when done at compile-time. This cases flaky test fails with the flang-x86_64-windows buildbot. Visual Studio 2026 refuses to compile it with error C2124. Use `std::numeric_limits<float>::infinity()` instead.
1 parent 1beda29 commit e19738d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

flang-rt/unittests/Runtime/Reduction.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -674,7 +674,7 @@ TEST(Reductions, ReduceInt4Dim) {
674674
}
675675

676676
TEST(Reductions, InfSums) {
677-
float inf{1.0f / 0.0f};
677+
auto inf{std::numeric_limits<float>::infinity()};
678678
auto inf0{MakeArray<TypeCategory::Real, 4>(
679679
std::vector<int>{2, 3}, std::vector<float>{inf, 0.0f})};
680680
auto t1{RTNAME(SumReal4)(*inf0, __FILE__, __LINE__)};

0 commit comments

Comments
 (0)