]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
openmp: Fix up !$omp target parallel handling
authorJakub Jelinek <jakub@redhat.com>
Wed, 22 Jan 2020 17:07:03 +0000 (18:07 +0100)
committerJakub Jelinek <jakub@redhat.com>
Wed, 22 Jan 2020 19:12:57 +0000 (20:12 +0100)
The PR93329 fix revealed we ICE on !$omp target parallel, this change fixes
that.

2020-01-22  Jakub Jelinek  <jakub@redhat.com>

* parse.c (parse_omp_structured_block): Handle ST_OMP_TARGET_PARALLEL.
* trans-openmp.c (gfc_trans_omp_target)
<case EXEC_OMP_TARGET_PARALLEL>: Call pushlevel first.

* gfortran.dg/gomp/target-parallel1.f90: New test.
* gfortran.dg/goacc/pr93329.f90: Enable commented out target parallel
test.

gcc/fortran/ChangeLog
gcc/fortran/parse.c
gcc/fortran/trans-openmp.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/goacc/pr93329.f90
gcc/testsuite/gfortran.dg/gomp/target-parallel1.f90 [new file with mode: 0644]

index 4d3bfa6d2f9d3e4dbfdea054374361ab4adccf36..d0d6fb57bb5d3a7a42db9c9b22569c38625f6203 100644 (file)
@@ -1,3 +1,9 @@
+2020-01-22  Jakub Jelinek  <jakub@redhat.com>
+
+       * parse.c (parse_omp_structured_block): Handle ST_OMP_TARGET_PARALLEL.
+       * trans-openmp.c (gfc_trans_omp_target)
+       <case EXEC_OMP_TARGET_PARALLEL>: Call pushlevel first.
+
 2020-01-22  Jakub Jelinek  <jakub@redhat.com>
 
        PR fortran/93329
index 86af947d1525be5f0c435c20526619995c13ac83..9e662a6612636100d30624573ca9b74afa7a1148 100644 (file)
@@ -5103,6 +5103,9 @@ parse_omp_structured_block (gfc_statement omp_st, bool workshare_stmts_only)
     case ST_OMP_TARGET_DATA:
       omp_end_st = ST_OMP_END_TARGET_DATA;
       break;
+    case ST_OMP_TARGET_PARALLEL:
+      omp_end_st = ST_OMP_END_TARGET_PARALLEL;
+      break;
     case ST_OMP_TARGET_TEAMS:
       omp_end_st = ST_OMP_END_TARGET_TEAMS;
       break;
index 98e3d58e174d994539a7ce30455984f36913e288..52a2cc8a4da9c8bdbc097233be2ee37d2aab0a25 100644 (file)
@@ -4783,6 +4783,7 @@ gfc_trans_omp_target (gfc_code *code)
       {
        stmtblock_t iblock;
 
+       pushlevel ();
        gfc_start_block (&iblock);
        tree inner_clauses
          = gfc_trans_omp_clauses (&block, &clausesa[GFC_OMP_SPLIT_PARALLEL],
index b458451fa8d0055af54b2dcd1a9d5000e8074475..d0d8279ef1970deaeb7f15fa0eaa2412efa0a9c6 100644 (file)
@@ -1,3 +1,9 @@
+2020-01-22  Jakub Jelinek  <jakub@redhat.com>
+
+       * gfortran.dg/gomp/target-parallel1.f90: New test.
+       * gfortran.dg/goacc/pr93329.f90: Enable commented out target parallel
+       test.
+
 2020-01-22  Jakub Jelinek  <jakub@redhat.com>
 
        PR fortran/93329
index e1feafd2ba2ba2265ac3f1663dcd4f94857dcbb7..b277bb1243c96ec800aca72a9b51a1749687bb76 100644 (file)
@@ -68,8 +68,8 @@
 !$omp target exit data map(from: x)    ! { dg-error "OMP TARGET EXIT DATA directive cannot be specified within" }
 !$acc end kernels
 !$acc kernels
-!!$omp target parallel
-!!$omp end target parallel
+!$omp target parallel          ! { dg-error "OMP TARGET PARALLEL directive cannot be specified within" }
+!$omp end target parallel
 !$acc end kernels
 !$acc kernels
 !$omp target parallel do       ! { dg-error "OMP TARGET PARALLEL DO directive cannot be specified within" }
diff --git a/gcc/testsuite/gfortran.dg/gomp/target-parallel1.f90 b/gcc/testsuite/gfortran.dg/gomp/target-parallel1.f90
new file mode 100644 (file)
index 0000000..bb8561f
--- /dev/null
@@ -0,0 +1,4 @@
+!$omp target parallel
+  print *, 'Hello, world'
+!$omp end target parallel
+end