[flang-commits] [flang] 9faed88 - Fixed erring semantic errors arising from D108904

Nimish Mishra via flang-commits flang-commits at lists.llvm.org
Fri Oct 29 09:44:13 PDT 2021


Author: Nimish Mishra
Date: 2021-10-30T03:44:59+05:30
New Revision: 9faed889cfebf5d77faf1fab1ef8f0a2f0255e5c

URL: https://github.com/llvm/llvm-project/commit/9faed889cfebf5d77faf1fab1ef8f0a2f0255e5c
DIFF: https://github.com/llvm/llvm-project/commit/9faed889cfebf5d77faf1fab1ef8f0a2f0255e5c.diff

LOG: Fixed erring semantic errors arising from D108904

Added: 
    

Modified: 
    flang/lib/Semantics/check-directive-structure.h
    flang/test/Semantics/omp-do05.f90

Removed: 
    


################################################################################
diff  --git a/flang/lib/Semantics/check-directive-structure.h b/flang/lib/Semantics/check-directive-structure.h
index af10be44aef67..0a0fe1cad4ce9 100644
--- a/flang/lib/Semantics/check-directive-structure.h
+++ b/flang/lib/Semantics/check-directive-structure.h
@@ -66,8 +66,14 @@ template <typename D> class NoBranchingEnforce {
       switch ((llvm::omp::Directive)currentDirective_) {
       // exclude directives which do not need a check for unlabelled CYCLES
       case llvm::omp::Directive::OMPD_do:
-        return;
       case llvm::omp::Directive::OMPD_simd:
+      case llvm::omp::Directive::OMPD_parallel_do:
+      case llvm::omp::Directive::OMPD_parallel_do_simd:
+      case llvm::omp::Directive::OMPD_distribute_parallel_do:
+      case llvm::omp::Directive::OMPD_distribute_parallel_do_simd:
+      case llvm::omp::Directive::OMPD_distribute_parallel_for:
+      case llvm::omp::Directive::OMPD_distribute_simd:
+      case llvm::omp::Directive::OMPD_distribute_parallel_for_simd:
         return;
       default:
         break;

diff  --git a/flang/test/Semantics/omp-do05.f90 b/flang/test/Semantics/omp-do05.f90
index a88d50bfea5f8..9e207a03da997 100644
--- a/flang/test/Semantics/omp-do05.f90
+++ b/flang/test/Semantics/omp-do05.f90
@@ -9,6 +9,9 @@ program omp_do
   integer i,j,k
   !$omp do
   do i=1,10
+    if( i == 5 ) then
+        cycle
+    end if
     !ERROR: A worksharing region may not be closely nested inside a worksharing, explicit task, taskloop, critical, ordered, atomic, or master region
     !$omp single
     do j=1,10
@@ -20,6 +23,8 @@ program omp_do
 
   !$omp parallel do
   do i=1,10
+    if( i == 9 ) then
+    end if
     !ERROR: A worksharing region may not be closely nested inside a worksharing, explicit task, taskloop, critical, ordered, atomic, or master region
     !$omp single
     do j=1,10
@@ -31,6 +36,9 @@ program omp_do
 
   !$omp parallel do simd
   do i=1,10
+    if( i == 5 ) then
+        cycle
+    end if
     !ERROR: The only OpenMP constructs that can be encountered during execution of a 'SIMD' region are the `ATOMIC` construct, the `LOOP` construct, the `SIMD` construct and the `ORDERED` construct with the `SIMD` clause.
     !ERROR: A worksharing region may not be closely nested inside a worksharing, explicit task, taskloop, critical, ordered, atomic, or master region
     !$omp single
@@ -44,6 +52,9 @@ program omp_do
   !ERROR: `DISTRIBUTE` region has to be strictly nested inside `TEAMS` region.
   !$omp distribute parallel do
   do i=1,10
+    if( i == 3 ) then
+        cycle
+    end if
     !ERROR: A worksharing region may not be closely nested inside a worksharing, explicit task, taskloop, critical, ordered, atomic, or master region
     !$omp single
     do j=1,10
@@ -56,6 +67,9 @@ program omp_do
   !ERROR: `DISTRIBUTE` region has to be strictly nested inside `TEAMS` region.
   !$omp distribute parallel do simd
   do i=1,10
+    if( i == 3 ) then
+        cycle
+    end if
     !ERROR: The only OpenMP constructs that can be encountered during execution of a 'SIMD' region are the `ATOMIC` construct, the `LOOP` construct, the `SIMD` construct and the `ORDERED` construct with the `SIMD` clause.
     !ERROR: A worksharing region may not be closely nested inside a worksharing, explicit task, taskloop, critical, ordered, atomic, or master region
     !$omp single


        


More information about the flang-commits mailing list