summaryrefslogtreecommitdiff
path: root/libgomp/testsuite/libgomp.fortran/task1.f90
blob: df57cb8316897a2d766efb9bf2203342b6da83a8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
! { dg-do run }

program tasktest
  use omp_lib
  integer :: i, j
  common /tasktest_j/ j
  j = 0
  !$omp parallel private (i)
    i = omp_get_thread_num ()
    if (i.lt.2) then
      !$omp task if (.false.) default(firstprivate)
        call subr (i + 1)
      !$omp end task
    end if
  !$omp end parallel
  if (j.gt.0) call abort
contains
  subroutine subr (i)
    use omp_lib
    integer :: i, j
    common /tasktest_j/ j
    if (omp_get_thread_num ().ne.(i - 1)) then
    !$omp atomic
      j = j + 1
    end if
  end subroutine subr
end program tasktest