1! RUN: %python %S/../test_errors.py %s %flang -fopenmp
2!XFAIL: *
3! OpenMP version 5.0.0
4! 2.8.1 sections construct
5! 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
6!TODO: Error in parsing. Make parser errors more informative. Until then, the test is XFAIL
7
8program OmpOrphanedSections
9   use omp_lib
10   integer counter
11   counter = 0
12   !CHECK: expected 'END'
13   !CHECK: END PROGRAM statement
14   !CHECK: in the context: main program
15   !CHECK: expected 'END PROGRAM'
16   !CHECK: in the context: END PROGRAM statement
17   !CHECK: in the context: main program
18   !$omp section
19   print *, "An orphaned section containing a single statement"
20   !$omp section
21   counter = counter + 1
22   print *, "An orphaned section containing multiple statements"
23!$omp sections
24   !$omp section
25   print *, "Not an orphan structured block"
26!$omp end sections
27end program OmpOrphanedSections
28