Skip to content

Commit

Permalink
[flang] [OpenMP] structural checks for PARALLEL SECTIONS
Browse files Browse the repository at this point in the history
  • Loading branch information
gpupuck authored and ichoyjx committed Aug 29, 2019
1 parent ffb8854 commit f6273d7
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
9 changes: 8 additions & 1 deletion flang/lib/semantics/check-omp-structure.cc
Expand Up @@ -277,7 +277,14 @@ void OmpStructureChecker::Enter(const parser::OpenMPSectionsConstruct &x) {
SetContextAllowed(allowed);
} break;
case parser::OmpSectionsDirective::Directive::ParallelSections: {
// TODO
PushContext(beginDir.source, OmpDirective::PARALLEL_SECTIONS);
OmpClauseSet allowed{OmpClause::DEFAULT, OmpClause::PRIVATE,
OmpClause::FIRSTPRIVATE, OmpClause::LASTPRIVATE, OmpClause::SHARED,
OmpClause::COPYIN, OmpClause::REDUCTION};
SetContextAllowed(allowed);
OmpClauseSet allowedOnce{
OmpClause::IF, OmpClause::NUM_THREADS, OmpClause::PROC_BIND};
SetContextAllowedOnce(allowedOnce);
} break;
}
}
Expand Down
22 changes: 22 additions & 0 deletions flang/test/semantics/omp-clause-validity01.f90
Expand Up @@ -210,6 +210,28 @@
!$omp end sections num_threads(4)
!$omp end parallel

! 2.11.2 parallel-sections-clause -> parallel-clause |
! sections-clause

!$omp parallel sections num_threads(4) private(b) lastprivate(d)
a = 0.0
!$omp section
b = 1
c = 2
!$omp section
d = 3
!$omp end parallel sections

!ERROR: At most one NUM_THREADS clause can appear on the PARALLEL SECTIONS directive
!$omp parallel sections num_threads(1) num_threads(4)
a = 0.0
!ERROR: Unmatched END SECTIONS directive
!$omp end sections

!$omp parallel sections
!ERROR: NOWAIT clause is not allowed on the END PARALLEL SECTIONS directive
!$omp end parallel sections nowait

! 2.7.3 single-clause -> private-clause |
! firstprivate-clause
! end-single-clause -> copyprivate-clause |
Expand Down

0 comments on commit f6273d7

Please sign in to comment.