Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions flang/lib/Semantics/check-omp-structure.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -200,8 +200,12 @@ bool OmpStructureChecker::CheckAllowedClause(llvmOmpClause clause) {
return CheckAllowed(clause);
}

bool OmpStructureChecker::IsVariableListItem(const Symbol &sym) {
return evaluate::IsVariable(sym) || sym.attrs().test(Attr::POINTER);
}

bool OmpStructureChecker::IsExtendedListItem(const Symbol &sym) {
return evaluate::IsVariable(sym) || sym.IsSubprogram();
return IsVariableListItem(sym) || sym.IsSubprogram();
}

bool OmpStructureChecker::IsCloselyNestedRegion(const OmpDirectiveSet &set) {
Expand Down Expand Up @@ -2351,7 +2355,7 @@ void OmpStructureChecker::Enter(const parser::OmpClause &x) {
SymbolSourceMap symbols;
GetSymbolsInObjectList(*objList, symbols);
for (const auto &[sym, source] : symbols) {
if (!evaluate::IsVariable(sym)) {
if (!IsVariableListItem(*sym)) {
deferredNonVariables_.insert({sym, source});
}
}
Expand Down Expand Up @@ -3428,7 +3432,7 @@ void OmpStructureChecker::Enter(const parser::OmpClause::To &x) {
SymbolSourceMap symbols;
GetSymbolsInObjectList(objList, symbols);
for (const auto &[sym, source] : symbols) {
if (!evaluate::IsVariable(*sym)) {
if (!IsVariableListItem(*sym)) {
context_.SayWithDecl(
*sym, source, "'%s' must be a variable"_err_en_US, sym->name());
}
Expand Down
1 change: 1 addition & 0 deletions flang/lib/Semantics/check-omp-structure.h
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ class OmpStructureChecker

private:
bool CheckAllowedClause(llvmOmpClause clause);
bool IsVariableListItem(const Symbol &sym);
bool IsExtendedListItem(const Symbol &sym);
void CheckMultipleOccurrence(semantics::UnorderedSymbolSet &listVars,
const std::list<parser::Name> &nameList, const parser::CharBlock &item,
Expand Down
13 changes: 13 additions & 0 deletions flang/test/Semantics/OpenMP/shared-pointer.f90
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
!RUN: %flang_fc1 -fopenmp -emit-fir -o - %s | FileCheck %s
!RUN: bbc -fopenmp -emit-fir -o - %s | FileCheck %s

!Allow POINTER variables in OpenMP SHARED clause. Check that this
!code compiles.

!CHECK-LABEL: func.func @_QPfoo
subroutine foo()
procedure(), pointer :: pf
!$omp parallel shared(pf)
!$omp end parallel
end

Loading