According to OpenMP 5.0 spec document, the following semantic restrictions have been dealt with in this patch. 1. [sections construct] Orphaned section directives are prohibited. That is, the section directives must appear within the sections construct and must not be encountered elsewhere in the sections region. Semantic checks for the following are not necessary, since use of orphaned section construct (i.e. without an enclosing sections directive) throws parser errors and control flow never reaches the semantic checking phase. Added a test case for the same. 2. [sections construct] Must be a structured block Added test case and made changes to branching logic 3. [simd construct] Must be a structured block / A program that branches in or out of a function with declare simd is non conforming 4. Fixed !$omp do's handling of unlabeled CYCLEs Reviewed By: kiranchandramohan Differential Revision: https://reviews.llvm.org/D108904
28 lines
1001 B
Fortran
28 lines
1001 B
Fortran
! RUN: %python %S/test_errors.py %s %flang -fopenmp
|
|
!XFAIL: *
|
|
! OpenMP version 5.0.0
|
|
! 2.8.1 sections construct
|
|
! Orphaned section directives are prohibited. That is, the section directives must appear within the sections construct and must not be encountered elsewhere in the sections region
|
|
!TODO: Error in parsing. Make parser errors more informative. Until then, the test is XFAIL
|
|
|
|
program OmpOrphanedSections
|
|
use omp_lib
|
|
integer counter
|
|
counter = 0
|
|
!CHECK: expected 'END'
|
|
!CHECK: END PROGRAM statement
|
|
!CHECK: in the context: main program
|
|
!CHECK: expected 'END PROGRAM'
|
|
!CHECK: in the context: END PROGRAM statement
|
|
!CHECK: in the context: main program
|
|
!$omp section
|
|
print *, "An orphaned section containing a single statement"
|
|
!$omp section
|
|
counter = counter + 1
|
|
print *, "An orphaned section containing multiple statements"
|
|
!$omp sections
|
|
!$omp section
|
|
print *, "Not an orphan structured block"
|
|
!$omp end sections
|
|
end program OmpOrphanedSections
|