19
19
#include " flang/Parser/parse-tree.h"
20
20
#include " flang/Parser/tools.h"
21
21
#include " flang/Semantics/expression.h"
22
+ #include " flang/Semantics/symbol.h"
22
23
#include " flang/Semantics/tools.h"
23
24
#include < list>
24
25
#include < map>
@@ -717,7 +718,7 @@ class OmpAttributeVisitor : DirectiveAttributeVisitor<llvm::omp::Directive> {
717
718
void CheckDataCopyingClause (
718
719
const parser::Name &, const Symbol &, Symbol::Flag);
719
720
void CheckAssocLoopLevel (std::int64_t level, const parser::OmpClause *clause);
720
- void CheckObjectInNamelist (
721
+ void CheckObjectInNamelistOrAssociate (
721
722
const parser::Name &, const Symbol &, Symbol::Flag);
722
723
void CheckSourceLabel (const parser::Label &);
723
724
void CheckLabelContext (const parser::CharBlock, const parser::CharBlock,
@@ -2356,7 +2357,7 @@ void OmpAttributeVisitor::ResolveOmpObject(
2356
2357
CheckMultipleAppearances (*name, *symbol, ompFlag);
2357
2358
}
2358
2359
if (privateDataSharingAttributeFlags.test (ompFlag)) {
2359
- CheckObjectInNamelist (*name, *symbol, ompFlag);
2360
+ CheckObjectInNamelistOrAssociate (*name, *symbol, ompFlag);
2360
2361
}
2361
2362
2362
2363
if (ompFlag == Symbol::Flag::OmpAllocate) {
@@ -2713,7 +2714,7 @@ void OmpAttributeVisitor::CheckDataCopyingClause(
2713
2714
}
2714
2715
}
2715
2716
2716
- void OmpAttributeVisitor::CheckObjectInNamelist (
2717
+ void OmpAttributeVisitor::CheckObjectInNamelistOrAssociate (
2717
2718
const parser::Name &name, const Symbol &symbol, Symbol::Flag ompFlag) {
2718
2719
const auto &ultimateSymbol{symbol.GetUltimate ()};
2719
2720
llvm::StringRef clauseName{" PRIVATE" };
@@ -2728,6 +2729,12 @@ void OmpAttributeVisitor::CheckObjectInNamelist(
2728
2729
" Variable '%s' in NAMELIST cannot be in a %s clause" _err_en_US,
2729
2730
name.ToString (), clauseName.str ());
2730
2731
}
2732
+
2733
+ if (ultimateSymbol.has <AssocEntityDetails>()) {
2734
+ context_.Say (name.source ,
2735
+ " Variable '%s' in ASSOCIATE cannot be in a %s clause" _err_en_US,
2736
+ name.ToString (), clauseName.str ());
2737
+ }
2731
2738
}
2732
2739
2733
2740
void OmpAttributeVisitor::CheckSourceLabel (const parser::Label &label) {
0 commit comments