[flang-commits] [flang] [Flang][OpenMP] Fix false positive common block error in LINEAR clause (PR #189170)
via flang-commits
flang-commits at lists.llvm.org
Sat Mar 28 08:38:00 PDT 2026
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-flang-openmp
@llvm/pr-subscribers-flang-semantics
Author: Aditya Trivedi (adit4443ya)
<details>
<summary>Changes</summary>
Fixes #<!-- -->184923
CC: @<!-- -->kparzysz @<!-- -->ohno-fj
---
Full diff: https://github.com/llvm/llvm-project/pull/189170.diff
2 Files Affected:
- (modified) flang/lib/Semantics/check-omp-loop.cpp (+1-1)
- (modified) flang/test/Semantics/OpenMP/linear-clause01.f90 (-1)
``````````diff
diff --git a/flang/lib/Semantics/check-omp-loop.cpp b/flang/lib/Semantics/check-omp-loop.cpp
index e35e83e5b191b..9f3858784860f 100644
--- a/flang/lib/Semantics/check-omp-loop.cpp
+++ b/flang/lib/Semantics/check-omp-loop.cpp
@@ -750,7 +750,7 @@ void OmpStructureChecker::Enter(const parser::OmpClause::Linear &x) {
"The list item `%s` in a LINEAR clause must not be Cray Pointer or a variable with POINTER attribute"_err_en_US,
symbol->name());
}
- if (FindCommonBlockContaining(*symbol)) {
+ if (symbol->has<CommonBlockDetails>()) {
context_.Say(source,
"'%s' is a common block name and must not appear in an LINEAR clause"_err_en_US,
symbol->name());
diff --git a/flang/test/Semantics/OpenMP/linear-clause01.f90 b/flang/test/Semantics/OpenMP/linear-clause01.f90
index 63b09c07875e5..60a8ade1c954c 100644
--- a/flang/test/Semantics/OpenMP/linear-clause01.f90
+++ b/flang/test/Semantics/OpenMP/linear-clause01.f90
@@ -44,6 +44,5 @@ subroutine linear_clause_03(arg)
integer :: i
common /cc/ i
!ERROR: The list item `i` must be a dummy argument
- !ERROR: 'i' is a common block name and must not appear in an LINEAR clause
!$omp declare simd linear(i)
end subroutine linear_clause_03
``````````
</details>
https://github.com/llvm/llvm-project/pull/189170
More information about the flang-commits
mailing list