[flang-commits] [flang] Reland "[flang] Avoid undefined behaviour when parsing format expressions (#147539)" (PR #148169)
via flang-commits
flang-commits at lists.llvm.org
Fri Jul 11 06:05:48 PDT 2025
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff HEAD~1 HEAD --extensions h -- flang/include/flang/Common/format.h
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/flang/include/flang/Common/format.h b/flang/include/flang/Common/format.h
index ed12e3a5f..8b4ffe63c 100644
--- a/flang/include/flang/Common/format.h
+++ b/flang/include/flang/Common/format.h
@@ -81,11 +81,12 @@ static inline bool MulOverflow(int64_t X, int64_t Y, int64_t &Result) {
// Check how the max allowed absolute value (2^n for negative, 2^(n-1) for
// positive) divided by an argument compares to the other.
if (IsNegative)
- return UX >
- (static_cast<uint64_t>(std::numeric_limits<int64_t>::max()) + uint64_t(1)) /
+ return UX > (static_cast<uint64_t>(std::numeric_limits<int64_t>::max()) +
+ uint64_t(1)) /
UY;
else
- return UX > (static_cast<uint64_t>(std::numeric_limits<int64_t>::max())) / UY;
+ return UX >
+ (static_cast<uint64_t>(std::numeric_limits<int64_t>::max())) / UY;
#endif
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/148169
More information about the flang-commits
mailing list