diff --git a/flang/runtime/extrema.cpp b/flang/runtime/extrema.cpp --- a/flang/runtime/extrema.cpp +++ b/flang/runtime/extrema.cpp @@ -800,7 +800,7 @@ bool Accumulate(Type x) { auto absX{std::abs(static_cast(x))}; if (!max_) { - max_ = x; + max_ = absX; } else if (absX > max_) { auto t{max_ / absX}; // < 1.0 auto tsq{t * t};