Skip to content

Commit

Permalink
Revert "[Flang][OpenMP] Add semantic check for OpenMP Private, Firstp…
Browse files Browse the repository at this point in the history
…rivate and Lastprivate clauses."

This reverts commit a2ca6bb.

D93213 performs some checks to ensure that variables that appear in
statement functions are not in privatisation clauses. The point at
which this check is currently performed, there can be misparses that
cause more constructs to be identified as statement functions. This
can lead to various kinds of errors, hence reverting.

This revert hopefully fixes:
#54477
#54161
#54163

Reviewed By: shraiysh

Differential Revision: https://reviews.llvm.org/D122650
  • Loading branch information
kiranchandramohan committed Apr 3, 2022
1 parent baebf23 commit 0000030
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 62 deletions.
26 changes: 3 additions & 23 deletions flang/lib/Semantics/resolve-directives.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -279,18 +279,6 @@ class OmpAttributeVisitor : DirectiveAttributeVisitor<llvm::omp::Directive> {
return true;
}

bool Pre(const parser::StmtFunctionStmt &x) {
const auto &parsedExpr{std::get<parser::Scalar<parser::Expr>>(x.t)};
if (const auto *expr{GetExpr(parsedExpr)}) {
for (const Symbol &symbol : evaluate::CollectSymbols(*expr)) {
if (!IsStmtFunctionDummy(symbol)) {
stmtFunctionExprSymbols_.insert(symbol.GetUltimate());
}
}
}
return true;
}

bool Pre(const parser::OpenMPBlockConstruct &);
void Post(const parser::OpenMPBlockConstruct &);

Expand Down Expand Up @@ -530,7 +518,7 @@ class OmpAttributeVisitor : DirectiveAttributeVisitor<llvm::omp::Directive> {
void CheckDataCopyingClause(
const parser::Name &, const Symbol &, Symbol::Flag);
void CheckAssocLoopLevel(std::int64_t level, const parser::OmpClause *clause);
void CheckPrivateDSAObject(
void CheckObjectInNamelist(
const parser::Name &, const Symbol &, Symbol::Flag);
void CheckSourceLabel(const parser::Label &);
void CheckLabelContext(const parser::CharBlock, const parser::CharBlock,
Expand Down Expand Up @@ -1585,7 +1573,7 @@ void OmpAttributeVisitor::ResolveOmpObject(
CheckMultipleAppearances(*name, *symbol, ompFlag);
}
if (privateDataSharingAttributeFlags.test(ompFlag)) {
CheckPrivateDSAObject(*name, *symbol, ompFlag);
CheckObjectInNamelist(*name, *symbol, ompFlag);
}

if (ompFlag == Symbol::Flag::OmpAllocate) {
Expand Down Expand Up @@ -1779,7 +1767,7 @@ void OmpAttributeVisitor::CheckDataCopyingClause(
}
}

void OmpAttributeVisitor::CheckPrivateDSAObject(
void OmpAttributeVisitor::CheckObjectInNamelist(
const parser::Name &name, const Symbol &symbol, Symbol::Flag ompFlag) {
const auto &ultimateSymbol{symbol.GetUltimate()};
llvm::StringRef clauseName{"PRIVATE"};
Expand All @@ -1794,14 +1782,6 @@ void OmpAttributeVisitor::CheckPrivateDSAObject(
"Variable '%s' in NAMELIST cannot be in a %s clause"_err_en_US,
name.ToString(), clauseName.str());
}

if (stmtFunctionExprSymbols_.find(ultimateSymbol) !=
stmtFunctionExprSymbols_.end()) {
context_.Say(name.source,
"Variable '%s' in STATEMENT FUNCTION expression cannot be in a "
"%s clause"_err_en_US,
name.ToString(), clauseName.str());
}
}

void OmpAttributeVisitor::CheckSourceLabel(const parser::Label &label) {
Expand Down
39 changes: 0 additions & 39 deletions flang/test/Semantics/omp-private03.f90

This file was deleted.

0 comments on commit 0000030

Please sign in to comment.