[Fortran] OpenACC – permit common blocks in some clauses
[official-gcc.git] / libgomp / testsuite / libgomp.fortran / collapse2.f90
blob32d9fdd816f1111df0d128825e999d67d7bb430e
1 ! { dg-do run }
2 ! { dg-options "-std=legacy" }
4 program collapse2
5 call test1
6 call test2
7 contains
8 subroutine test1
9 integer :: i, j, k, a(1:3, 4:6, 5:7)
10 logical :: l
11 l = .false.
12 a(:, :, :) = 0
13 !$omp parallel do collapse(4 - 1) schedule(static, 4)
14 do 164 i = 1, 3
15 do 164 j = 4, 6
16 do 164 k = 5, 7
17 a(i, j, k) = i + j + k
18 164 end do
19 !$omp parallel do collapse(2) reduction(.or.:l)
20 firstdo: do i = 1, 3
21 do j = 4, 6
22 do k = 5, 7
23 if (a(i, j, k) .ne. (i + j + k)) l = .true.
24 end do
25 end do
26 end do firstdo
27 !$omp end parallel do
28 if (l) STOP 1
29 end subroutine test1
31 subroutine test2
32 integer :: a(3,3,3), k, kk, kkk, l, ll, lll
33 !$omp do collapse(3)
34 do 115 k=1,3
35 dokk: do kk=1,3
36 do kkk=1,3
37 a(k,kk,kkk) = 1
38 enddo
39 enddo dokk
40 115 continue
41 if (any(a(1:3,1:3,1:3).ne.1)) STOP 2
43 !$omp do collapse(3)
44 dol: do 120 l=1,3
45 doll: do ll=1,3
46 do lll=1,3
47 a(l,ll,lll) = 2
48 enddo
49 enddo doll
50 120 end do dol
51 if (any(a(1:3,1:3,1:3).ne.2)) STOP 3
52 end subroutine test2
54 end program collapse2