Skip to content

Commit 890a8a0

Browse files
committed
[flang][OpenMP] Allow flush of common block
I think this was denied by accident in 68180d8. Flush of a common block is allowed by the standard on my reading. It is not allowed by classic-flang but is supported by gfortran and ifx. This doesn't need any lowering changes. The LLVM translation ignores the flush argument list because the openmp runtime library doesn't support flushing specific data. Depends upon #139522. Ignore the first commit in this PR.
1 parent a647510 commit 890a8a0

File tree

3 files changed

+13
-18
lines changed

3 files changed

+13
-18
lines changed

flang/lib/Semantics/check-omp-structure.cpp

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2304,13 +2304,6 @@ void OmpStructureChecker::Leave(const parser::OpenMPFlushConstruct &x) {
23042304
auto &flushList{std::get<std::optional<parser::OmpArgumentList>>(x.v.t)};
23052305

23062306
if (flushList) {
2307-
for (const parser::OmpArgument &arg : flushList->v) {
2308-
if (auto *sym{GetArgumentSymbol(arg)}; sym && !IsVariableListItem(*sym)) {
2309-
context_.Say(arg.source,
2310-
"FLUSH argument must be a variable list item"_err_en_US);
2311-
}
2312-
}
2313-
23142307
if (FindClause(llvm::omp::Clause::OMPC_acquire) ||
23152308
FindClause(llvm::omp::Clause::OMPC_release) ||
23162309
FindClause(llvm::omp::Clause::OMPC_acq_rel)) {
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
! RUN: %flang_fc1 -fopenmp -emit-hlfir -o - %s | FileCheck %s
2+
3+
! Regression test to ensure that the name /c/ in the flush argument list is
4+
! resolved to the common block symbol and common blocks are allowed in the
5+
! flush argument list.
6+
7+
! CHECK: %[[GLBL:.*]] = fir.address_of({{.*}}) : !fir.ref<!fir.array<4xi8>>
8+
common /c/ x
9+
real :: x
10+
! CHECK: omp.flush(%[[GLBL]] : !fir.ref<!fir.array<4xi8>>)
11+
!$omp flush(/c/)
12+
end
13+

flang/test/Semantics/OpenMP/flush04.f90

Lines changed: 0 additions & 11 deletions
This file was deleted.

0 commit comments

Comments
 (0)