2016-08-31 Jakub Jelinek <jakub@redhat.com>
+ PR fortran/77352
+ * trans-openmp.c (gfc_trans_omp_parallel_workshare): Always add a
+ BIND_EXPR with BLOCK around what gfc_trans_omp_workshare returns.
+
PR fortran/77374
* parse.c (parse_omp_oacc_atomic): Copy over cp->ext.omp_atomic
to cp->block->ext.omp_atomic.
code->loc);
pushlevel ();
stmt = gfc_trans_omp_workshare (code, &workshare_clauses);
- if (TREE_CODE (stmt) != BIND_EXPR)
- stmt = build3_v (BIND_EXPR, NULL, stmt, poplevel (1, 0));
- else
- poplevel (0, 0);
+ stmt = build3_v (BIND_EXPR, NULL, stmt, poplevel (1, 0));
stmt = build2_loc (input_location, OMP_PARALLEL, void_type_node, stmt,
omp_clauses);
OMP_PARALLEL_COMBINED (stmt) = 1;
2016-08-31 Jakub Jelinek <jakub@redhat.com>
+ PR fortran/77352
+ * gfortran.dg/gomp/pr77352.f90: New test.
+
PR fortran/77374
* gfortran.dg/gomp/pr77374.f08: New test.
--- /dev/null
+! PR fortran/77352
+! { dg-do compile }
+! { dg-additional-options "-fstack-arrays -O2" }
+! { dg-additional-options "-fopenacc" { target fopenacc } }
+
+program pr77352
+ real, allocatable :: a(:,:), b(:)
+ integer :: m, n
+ m = 4
+ n = 2
+ allocate (a(m,n), b(m))
+ a = 1.0
+!$omp parallel workshare
+ b(:) = [ sum(a, dim=1) ]
+!$omp end parallel workshare
+end