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
4 changes: 3 additions & 1 deletion flang/lib/Semantics/resolve-directives.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2152,7 +2152,9 @@ void OmpAttributeVisitor::CreateImplicitSymbols(
dirContext.defaultDSA == Symbol::Flag::OmpShared) {
// 1) default
// Allowed only with parallel, teams and task generating constructs.
assert(parallelDir || taskGenDir || teamsDir);
if (!parallelDir && !taskGenDir && !teamsDir) {
return;
}
if (dirContext.defaultDSA != Symbol::Flag::OmpShared)
makePrivateSymbol(dirContext.defaultDSA);
else
Expand Down
9 changes: 9 additions & 0 deletions flang/test/Semantics/OpenMP/default.f90
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,13 @@ program omp_default
end do
!$omp end teams

!$omp parallel
!ERROR: DEFAULT clause is not allowed on the DO directive
!$omp do default(private)
do i = 1, 10
k = i
end do
!$omp end do
!$omp end parallel

end program omp_default