File tree Expand file tree Collapse file tree 2 files changed +38
-2
lines changed Expand file tree Collapse file tree 2 files changed +38
-2
lines changed Original file line number Diff line number Diff line change @@ -1500,10 +1500,33 @@ void OmpStructureChecker::CheckAlignValue(const parser::OmpClause &clause) {
15001500
15011501void OmpStructureChecker::Enter (const parser::OpenMPDeclarativeAllocate &x) {
15021502 isPredefinedAllocator = true ;
1503+ SymbolSourceMap symbols;
15031504 const auto &dir{std::get<parser::Verbatim>(x.t )};
15041505 const auto &objectList{std::get<parser::OmpObjectList>(x.t )};
15051506 PushContextAndClauseSets (dir.source , llvm::omp::Directive::OMPD_allocate);
15061507 const auto &clauseList{std::get<parser::OmpClauseList>(x.t )};
1508+ SymbolSourceMap currSymbols;
1509+ GetSymbolsInObjectList (objectList, currSymbols);
1510+ for (auto &[symbol, source] : currSymbols) {
1511+ if (IsPointer (*symbol)) {
1512+ context_.Say (source,
1513+ " List item '%s' in ALLOCATE directive must not have POINTER "
1514+ " attribute" _err_en_US,
1515+ source.ToString ());
1516+ }
1517+ if (IsDummy (*symbol)) {
1518+ context_.Say (source,
1519+ " List item '%s' in ALLOCATE directive must not be a dummy "
1520+ " argument" _err_en_US,
1521+ source.ToString ());
1522+ }
1523+ if (symbol->has <AssocEntityDetails>()) {
1524+ context_.Say (source,
1525+ " List item '%s' in ALLOCATE directive must not be an associate "
1526+ " name" _err_en_US,
1527+ source.ToString ());
1528+ }
1529+ }
15071530 for (const auto &clause : clauseList.v ) {
15081531 CheckAlignValue (clause);
15091532 }
Original file line number Diff line number Diff line change 44! OpenMP Version 5.0
55! 2.11.3 allocate Directive
66! Only the allocator clause is allowed on the allocate directive
7- subroutine allocate ()
7+ ! List item in ALLOCATE directive must not be a dummy argument
8+ ! List item in ALLOCATE directive must not have POINTER attribute
9+ ! List item in ALLOCATE directive must not be a associate name
10+ subroutine allocate (z )
811use omp_lib
12+ use iso_c_binding
913
10- integer :: x, y
14+ type (c_ptr), pointer :: p
15+ integer :: x, y, z
1116
17+ associate (a = > x)
1218 ! $omp allocate(x) allocator(omp_default_mem_alloc)
1319
1420 ! ERROR: PRIVATE clause is not allowed on the ALLOCATE directive
1521 ! $omp allocate(y) private(y)
22+ ! ERROR: List item 'z' in ALLOCATE directive must not be a dummy argument
23+ ! $omp allocate(z)
24+ ! ERROR: List item 'p' in ALLOCATE directive must not have POINTER attribute
25+ ! $omp allocate(p)
26+ ! ERROR: List item 'a' in ALLOCATE directive must not be an associate name
27+ ! $omp allocate(a)
28+ end associate
1629end subroutine allocate
You can’t perform that action at this time.
0 commit comments