File tree Expand file tree Collapse file tree 2 files changed +37
-2
lines changed Expand file tree Collapse file tree 2 files changed +37
-2
lines changed Original file line number Diff line number Diff line change @@ -1692,6 +1692,28 @@ void OmpStructureChecker::Enter(const parser::OpenMPDeclarativeAllocate &x) {
1692
1692
const auto &objectList{std::get<parser::OmpObjectList>(x.t )};
1693
1693
PushContextAndClauseSets (dir.source , llvm::omp::Directive::OMPD_allocate);
1694
1694
const auto &clauseList{std::get<parser::OmpClauseList>(x.t )};
1695
+ SymbolSourceMap currSymbols;
1696
+ GetSymbolsInObjectList (objectList, currSymbols);
1697
+ for (auto &[symbol, source] : currSymbols) {
1698
+ if (IsPointer (*symbol)) {
1699
+ context_.Say (source,
1700
+ " List item '%s' in ALLOCATE directive must not have POINTER "
1701
+ " attribute" _err_en_US,
1702
+ source.ToString ());
1703
+ }
1704
+ if (IsDummy (*symbol)) {
1705
+ context_.Say (source,
1706
+ " List item '%s' in ALLOCATE directive must not be a dummy "
1707
+ " argument" _err_en_US,
1708
+ source.ToString ());
1709
+ }
1710
+ if (symbol->has <AssocEntityDetails>()) {
1711
+ context_.Say (source,
1712
+ " List item '%s' in ALLOCATE directive must not be an associate "
1713
+ " name" _err_en_US,
1714
+ source.ToString ());
1715
+ }
1716
+ }
1695
1717
for (const auto &clause : clauseList.v ) {
1696
1718
CheckAlignValue (clause);
1697
1719
}
Original file line number Diff line number Diff line change 4
4
! OpenMP Version 5.0
5
5
! 2.11.3 allocate Directive
6
6
! 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 )
8
11
use omp_lib
12
+ use iso_c_binding
9
13
10
- integer :: x, y
14
+ type (c_ptr), pointer :: p
15
+ integer :: x, y, z
11
16
17
+ associate (a = > x)
12
18
! $omp allocate(x) allocator(omp_default_mem_alloc)
13
19
14
20
! ERROR: PRIVATE clause is not allowed on the ALLOCATE directive
15
21
! $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
16
29
end subroutine allocate
You can’t perform that action at this time.
0 commit comments