summaryrefslogtreecommitdiff
path: root/libgomp/testsuite/libgomp.fortran/task3.f90
blob: 30ff9803ea27ea66bee48dbc66f23506c66f3909 (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 }
! { dg-options "-fopenmp" }
!
! PR fortran/47886
!
! Test case contributed by Bill Long

!  derived from OpenMP test OMP3f/F03_2_7_1d.F90
program F03_2_7_1d
   use omp_lib
   implicit none
   integer, parameter :: NT = 4
   integer :: sum = 0

   call omp_set_num_threads(NT); 

   !$omp parallel
   !$omp task if(omp_get_num_threads() > 0)
   !$omp atomic
      sum = sum + 1
   !$omp end task
   !$omp end parallel
   if (sum /= NT) then
      print *, "FAIL - sum == ", sum, " (expected ", NT, ")"
      call abort
   end if
end program F03_2_7_1d