* trans-expr.c (gfc_trans_assignment_1): Set OMPWS_SCALARIZER_WS
bit in ompws_flags only if loop.temp_ss is NULL, and clear it if
lhs needs reallocation.
* trans-openmp.c (gfc_trans_omp_workshare): Don't return early if
code is NULL, emit a barrier if workshare emitted no code at all
and NOWAIT clause isn't present.
* testsuite/libgomp.fortran/pr49792-1.f90: New test.
* testsuite/libgomp.fortran/pr49792-2.f90: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-4_6-branch@177900
138bc75d-0d04-0410-961f-
82ee72b054a4
+2011-08-19 Jakub Jelinek <jakub@redhat.com>
+
+ PR fortran/49792
+ * trans-expr.c (gfc_trans_assignment_1): Set OMPWS_SCALARIZER_WS
+ bit in ompws_flags only if loop.temp_ss is NULL, and clear it if
+ lhs needs reallocation.
+ * trans-openmp.c (gfc_trans_omp_workshare): Don't return early if
+ code is NULL, emit a barrier if workshare emitted no code at all
+ and NOWAIT clause isn't present.
+
2011-08-05 Janus Weil <janus@gcc.gnu.org>
PR fortran/49112
rss = NULL;
if (lss != gfc_ss_terminator)
{
- /* Allow the scalarizer to workshare array assignments. */
- if (ompws_flags & OMPWS_WORKSHARE_FLAG)
- ompws_flags |= OMPWS_SCALARIZER_WS;
-
/* The assignment needs scalarization. */
lss_section = lss;
gfc_mark_ss_chain_used (loop.temp_ss, 3);
}
+ /* Allow the scalarizer to workshare array assignments. */
+ if ((ompws_flags & OMPWS_WORKSHARE_FLAG) && loop.temp_ss == NULL)
+ ompws_flags |= OMPWS_SCALARIZER_WS;
+
/* Start the scalarized loop body. */
gfc_start_scalarized_body (&loop, &body);
}
&& !gfc_expr_attr (expr1).codimension
&& !gfc_is_coindexed (expr1))
{
+ ompws_flags &= ~OMPWS_SCALARIZER_WS;
tmp = gfc_alloc_allocatable_for_assignment (&loop, expr1, expr2);
if (tmp != NULL_TREE)
gfc_add_expr_to_block (&loop.code[expr1->rank - 1], tmp);
pushlevel (0);
- if (!code)
- return build_empty_stmt (input_location);
-
gfc_start_block (&block);
pblock = █
else
poplevel (0, 0, 0);
+ if (IS_EMPTY_STMT (stmt) && !clauses->nowait)
+ stmt = gfc_trans_omp_barrier ();
+
ompws_flags = 0;
return stmt;
}
+2011-08-19 Jakub Jelinek <jakub@redhat.com>
+
+ PR fortran/49792
+ * testsuite/libgomp.fortran/pr49792-1.f90: New test.
+ * testsuite/libgomp.fortran/pr49792-2.f90: New test.
+
2011-07-29 Jakub Jelinek <jakub@redhat.com>
PR middle-end/49897
--- /dev/null
+! PR fortran/49792
+! { dg-do run }
+
+subroutine reverse(n, a)
+ integer :: n
+ real(kind=8) :: a(n)
+!$omp parallel workshare
+ a(:) = a(n:1:-1)
+!$omp end parallel workshare
+end subroutine reverse
+
+program pr49792
+ real(kind=8) :: a(16) = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16]
+ real(kind=8) :: b(16)
+ b(:) = a(16:1:-1)
+ call reverse (16,a)
+ if (any (a.ne.b)) call abort
+end program pr49792
--- /dev/null
+! PR fortran/49792
+! { dg-do run }
+! { dg-options "-std=f2003 -fall-intrinsics" }
+
+subroutine reverse(n, a)
+ integer :: n
+ real(kind=8) :: a(n)
+!$omp parallel workshare
+ a(:) = a(n:1:-1)
+!$omp end parallel workshare
+end subroutine reverse
+
+program pr49792
+ integer :: b(16)
+ integer, allocatable :: a(:)
+ b = 1
+!$omp parallel workshare
+ a = b
+!$omp end parallel workshare
+ if (size(a).ne.size(b)) call abort()
+ if (any (a.ne.b)) call abort()
+end program pr49792