public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/vendors/ibm/heads/gcc-9)] openmp: Fix up !$omp target parallel handling
@ 2020-02-04 21:16 Peter Bergner
  0 siblings, 0 replies; only message in thread
From: Peter Bergner @ 2020-02-04 21:16 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:18cfaa4217fabce8df0f2aac5367bf4952a13f51

commit 18cfaa4217fabce8df0f2aac5367bf4952a13f51
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Wed Jan 22 18:07:03 2020 +0100

    openmp: Fix up !$omp target parallel handling
    
    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.

Diff:
---
 gcc/fortran/ChangeLog                               | 6 ++++++
 gcc/fortran/parse.c                                 | 3 +++
 gcc/fortran/trans-openmp.c                          | 1 +
 gcc/testsuite/ChangeLog                             | 6 ++++++
 gcc/testsuite/gfortran.dg/goacc/pr93329.f90         | 4 ++--
 gcc/testsuite/gfortran.dg/gomp/target-parallel1.f90 | 4 ++++
 6 files changed, 22 insertions(+), 2 deletions(-)

diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index 4d3bfa6..d0d6fb5 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,5 +1,11 @@
 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
 	* openmp.c (omp_code_to_statement): Handle remaining EXEC_OMP_*
 	cases.
diff --git a/gcc/fortran/parse.c b/gcc/fortran/parse.c
index 86af947..9e662a6 100644
--- a/gcc/fortran/parse.c
+++ b/gcc/fortran/parse.c
@@ -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;
diff --git a/gcc/fortran/trans-openmp.c b/gcc/fortran/trans-openmp.c
index 98e3d58..52a2cc8 100644
--- a/gcc/fortran/trans-openmp.c
+++ b/gcc/fortran/trans-openmp.c
@@ -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],
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index b458451..d0d8279 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,5 +1,11 @@
 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
 	* gfortran.dg/goacc/pr93329.f90: New test.
 
diff --git a/gcc/testsuite/gfortran.dg/goacc/pr93329.f90 b/gcc/testsuite/gfortran.dg/goacc/pr93329.f90
index e1feafd..b277bb1 100644
--- a/gcc/testsuite/gfortran.dg/goacc/pr93329.f90
+++ b/gcc/testsuite/gfortran.dg/goacc/pr93329.f90
@@ -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
index 0000000..bb8561f
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/gomp/target-parallel1.f90
@@ -0,0 +1,4 @@
+!$omp target parallel
+  print *, 'Hello, world'
+!$omp end target parallel
+end


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-02-04 21:16 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-04 21:16 [gcc(refs/vendors/ibm/heads/gcc-9)] openmp: Fix up !$omp target parallel handling Peter Bergner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).