Fix wrong assertion for LIPO
[official-gcc.git] / gcc-4_7-mobile / libgomp / testsuite / libgomp.fortran / allocatable1.f90
blob1efe2abe959b82f8dc26abbef3f6ce23db098a62
1 ! { dg-do run }
2 !$ use omp_lib
4 integer, allocatable :: a(:, :)
5 integer :: b(6, 3)
6 integer :: i, j
7 logical :: k, l
8 b(:, :) = 16
9 l = .false.
10 if (allocated (a)) call abort
11 !$omp parallel private (a, b) reduction (.or.:l)
12 l = l.or.allocated (a)
13 allocate (a(3, 6))
14 l = l.or..not.allocated (a)
15 l = l.or.size(a).ne.18.or.size(a,1).ne.3.or.size(a,2).ne.6
16 a(3, 2) = 1
17 b(3, 2) = 1
18 deallocate (a)
19 l = l.or.allocated (a)
20 !$omp end parallel
21 if (allocated (a).or.l) call abort
22 allocate (a(6, 3))
23 a(:, :) = 3
24 if (.not.allocated (a)) call abort
25 l = l.or.size(a).ne.18.or.size(a,1).ne.6.or.size(a,2).ne.3
26 if (l) call abort
27 !$omp parallel private (a, b) reduction (.or.:l)
28 l = l.or..not.allocated (a)
29 a(3, 2) = 1
30 b(3, 2) = 1
31 !$omp end parallel
32 if (l.or..not.allocated (a)) call abort
33 !$omp parallel firstprivate (a, b) reduction (.or.:l)
34 l = l.or..not.allocated (a)
35 l = l.or.size(a).ne.18.or.size(a,1).ne.6.or.size(a,2).ne.3
36 do i = 1, 6
37 l = l.or.(a(i, 1).ne.3).or.(a(i, 2).ne.3)
38 l = l.or.(a(i, 3).ne.3).or.(b(i, 1).ne.16)
39 l = l.or.(b(i, 2).ne.16).or.(b(i, 3).ne.16)
40 end do
41 a(:, :) = omp_get_thread_num ()
42 b(:, :) = omp_get_thread_num ()
43 !$omp end parallel
44 if (any (a.ne.3).or.any (b.ne.16).or.l) call abort
45 k = .true.
46 !$omp parallel do firstprivate (a, b, k) lastprivate (a, b) &
47 !$omp & reduction (.or.:l)
48 do i = 1, 36
49 l = l.or..not.allocated (a)
50 l = l.or.size(a).ne.18.or.size(a,1).ne.6.or.size(a,2).ne.3
51 if (k) then
52 do j = 1, 6
53 l = l.or.(a(j, 1).ne.3).or.(a(j, 2).ne.3)
54 l = l.or.(a(j, 3).ne.3).or.(b(j, 1).ne.16)
55 l = l.or.(b(j, 2).ne.16).or.(b(j, 3).ne.16)
56 end do
57 k = .false.
58 end if
59 a(:, :) = i + 2
60 b(:, :) = i
61 end do
62 if (any (a.ne.38).or.any (b.ne.36).or.l) call abort
63 deallocate (a)
64 if (allocated (a)) call abort
65 allocate (a (0:1, 0:3))
66 a(:, :) = 0
67 !$omp parallel do reduction (+:a) reduction (.or.:l) &
68 !$omp & num_threads(3) schedule(static)
69 do i = 0, 7
70 l = l.or..not.allocated (a)
71 l = l.or.size(a).ne.8.or.size(a,1).ne.2.or.size(a,2).ne.4
72 a(modulo (i, 2), i / 2) = a(modulo (i, 2), i / 2) + i
73 a(i / 4, modulo (i, 4)) = a(i / 4, modulo (i, 4)) + i
74 end do
75 if (l) call abort
76 do i = 0, 1
77 do j = 0, 3
78 if (a(i, j) .ne. (5*i + 3*j)) call abort
79 end do
80 end do
81 end