llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
27.84k stars 11.47k forks source link

[Flang][OpenMP] Add a proper test for orphaned section directive #93342

Open kiranchandramohan opened 3 months ago

kiranchandramohan commented 3 months ago

Section directive should appear in the sections construct. It cannot appear as orphaned directives. This is currently caught in parsing but there is no graceful error.

program OmpOrphanedSections
   use omp_lib
   integer counter
   counter = 0
   !$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
llvmbot commented 3 months ago

@llvm/issue-subscribers-clang-frontend

Author: Kiran Chandramohan (kiranchandramohan)

Section directive should appear in the sections construct. It cannot appear as orphaned directives. This is currently caught in parsing but there is no graceful error. ``` program OmpOrphanedSections use omp_lib integer counter counter = 0 !$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 ```
llvmbot commented 3 months ago

@llvm/issue-subscribers-flang-frontend

Author: Kiran Chandramohan (kiranchandramohan)

Section directive should appear in the sections construct. It cannot appear as orphaned directives. This is currently caught in parsing but there is no graceful error. ``` program OmpOrphanedSections use omp_lib integer counter counter = 0 !$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 ```