[committed] openmp: Fix up !$omp target parallel handling
diff mbox series

Message ID 20200122090310.GF10088@tucnak
State New
Headers show
Series
  • [committed] openmp: Fix up !$omp target parallel handling
Related show

Commit Message

Jakub Jelinek Jan. 22, 2020, 9:03 a.m. UTC
Hi!

The PR93329 fix revealed we ICE on !$omp target parallel, this change fixes
that.

Another case where some OpenMP 4.5 support has been added, but I didn't have
time to add corresponding testsuite coverage yet (~ backports of the C/C++
patches added when the C/C++ support has been added).

Bootstrapped/regtested on x86_64-linux and i686-linux, committed to trunk.

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.



	Jakub

Patch
diff mbox series

--- gcc/fortran/parse.c.jj	2020-01-12 11:54:36.594410678 +0100
+++ gcc/fortran/parse.c	2020-01-21 16:43:05.175529082 +0100
@@ -5231,6 +5231,9 @@  parse_omp_structured_block (gfc_statemen
     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;
--- gcc/fortran/trans-openmp.c.jj	2020-01-12 11:54:36.603410542 +0100
+++ gcc/fortran/trans-openmp.c	2020-01-21 16:56:13.041723952 +0100
@@ -5357,6 +5357,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],
--- gcc/testsuite/gfortran.dg/gomp/target-parallel1.f90.jj	2020-01-21 17:14:41.636075090 +0100
+++ gcc/testsuite/gfortran.dg/gomp/target-parallel1.f90	2020-01-21 17:14:27.292291382 +0100
@@ -0,0 +1,4 @@ 
+!$omp target parallel
+  print *, 'Hello, world'
+!$omp end target parallel
+end
--- gcc/testsuite/gfortran.dg/goacc/pr93329.f90.jj	2020-01-21 16:33:03.043571159 +0100
+++ gcc/testsuite/gfortran.dg/goacc/pr93329.f90	2020-01-21 17:15:11.508624618 +0100
@@ -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" }