aboutsummaryrefslogtreecommitdiff
path: root/libgomp/testsuite
diff options
context:
space:
mode:
authorTobias Burnus <tobias@codesourcery.com>2023-10-08 11:54:07 +0200
committerTobias Burnus <tobias@codesourcery.com>2023-10-08 11:54:07 +0200
commit6a8edd50a149f10621b59798c887c24c81c8b9ea (patch)
tree751b651dafaeba4758905671a5536351ffac1fce /libgomp/testsuite
parent3da32cc3d1e48f2eac1630e627d34723b9536166 (diff)
downloadgcc-6a8edd50a149f10621b59798c887c24c81c8b9ea.zip
gcc-6a8edd50a149f10621b59798c887c24c81c8b9ea.tar.gz
gcc-6a8edd50a149f10621b59798c887c24c81c8b9ea.tar.bz2
Fortran/OpenMP: Fix handling of strictly structured blocks
For strictly structured blocks, a BLOCK was created but the code was placed after the block the outer structured block. Additionally, labelled blocks were mishandled. As the code is now properly in a BLOCK, it solves additional issues. gcc/fortran/ChangeLog: * parse.cc (parse_omp_structured_block): Make the user code end up inside of BLOCK construct for strictly structured blocks; fix fallout for 'section' and 'teams'. * openmp.cc (resolve_omp_target): Fix changed BLOCK handling for teams in target checking. libgomp/ChangeLog: * testsuite/libgomp.fortran/strictly-structured-block-1.f90: New test. gcc/testsuite/ChangeLog: * gfortran.dg/block_17.f90: New test. * gfortran.dg/gomp/strictly-structured-block-5.f90: New test.
Diffstat (limited to 'libgomp/testsuite')
-rw-r--r--libgomp/testsuite/libgomp.fortran/strictly-structured-block-1.f9022
1 files changed, 22 insertions, 0 deletions
diff --git a/libgomp/testsuite/libgomp.fortran/strictly-structured-block-1.f90 b/libgomp/testsuite/libgomp.fortran/strictly-structured-block-1.f90
new file mode 100644
index 0000000..8e7f6c8
--- /dev/null
+++ b/libgomp/testsuite/libgomp.fortran/strictly-structured-block-1.f90
@@ -0,0 +1,22 @@
+subroutine one
+ implicit none (external, type)
+ integer :: i, j
+ i = 5
+ j = 6
+ !$omp parallel
+ my_block : block
+ !$omp atomic write
+ i = 7
+ exit my_block
+
+ !$omp atomic write
+ j = 99 ! Should be unreachable
+
+ ! exit should jump here - end of block but inside of it.
+ end block my_block
+ if (i /= 7) stop 1
+ if (j /= 6) stop 2
+end
+
+ call one
+end