[flang-commits] [flang] [flang][OpenMP] Fix crash when arrays used in LINEAR clause (PR #175383)

via flang-commits flang-commits at lists.llvm.org
Sat Jan 10 11:40:31 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/Semantics/check-omp-loop.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/Semantics/check-omp-loop.cpp b/flang/lib/Semantics/check-omp-loop.cpp
index 24cf674f8..a59e4f666 100644
--- a/flang/lib/Semantics/check-omp-loop.cpp
+++ b/flang/lib/Semantics/check-omp-loop.cpp
@@ -811,8 +811,7 @@ void OmpStructureChecker::Enter(const parser::OmpClause::Linear &x) {
     // Check that the list item is a scalar variable (rank 0)
     // For declare simd with REF modifier, arrays are allowed
     bool isArrayAllowed = dir == llvm::omp::Directive::OMPD_declare_simd &&
-                          linearMod &&
-                          linearMod->v == parser::OmpLinearModifier::Value::Ref;
+        linearMod && linearMod->v == parser::OmpLinearModifier::Value::Ref;
     if (symbol->Rank() != 0 && !isArrayAllowed) {
       context_.Say(source,
           "List item '%s' in LINEAR clause must be a scalar variable"_err_en_US,

``````````

</details>


https://github.com/llvm/llvm-project/pull/175383


More information about the flang-commits mailing list