[flang-commits] [flang] [flang] Reject SIZE of TRANSFER with non-constant source in constant expressions (PR #178939)
via flang-commits
flang-commits at lists.llvm.org
Fri Jan 30 10:56:07 PST 2026
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 origin/main HEAD --extensions cpp -- flang/lib/Evaluate/check-expression.cpp flang/lib/Evaluate/fold-integer.cpp --diff_from_common_commit
``````````
:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/flang/lib/Evaluate/check-expression.cpp b/flang/lib/Evaluate/check-expression.cpp
index b3f66dd56..8df6e9f8a 100644
--- a/flang/lib/Evaluate/check-expression.cpp
+++ b/flang/lib/Evaluate/check-expression.cpp
@@ -133,12 +133,12 @@ bool IsConstantExprHelper<INVARIANT>::operator()(
auto base{ExtractNamedEntity(call.arguments()[0]->UnwrapExpr())};
if (base) {
auto shape{GetShape(*base)};
- return shape && IsConstantExprShape(*shape);
+ return shape && IsConstantExprShape(*shape);
} else {
// Argument is not a named entity (e.g., it's a function call);
- // it must be a constant expression for SIZE/SHAPE to be constant.
- const auto *argExpr{call.arguments()[0]->UnwrapExpr()};
- return argExpr && (*this)(*argExpr);
+ // it must be a constant expression for SIZE/SHAPE to be constant.
+ const auto *argExpr{call.arguments()[0]->UnwrapExpr()};
+ return argExpr && (*this)(*argExpr);
}
} else if (proc.IsPure()) {
std::size_t j{0};
``````````
</details>
https://github.com/llvm/llvm-project/pull/178939
More information about the flang-commits
mailing list