Rebase.
[official-gcc.git] / libgomp / testsuite / libgomp.fortran / allocatable12.f90
blob533ab7cd85d9debfcc5e165d5a981d395847079e
1 ! { dg-do run }
3 integer, allocatable :: a, b(:), c(:,:)
4 logical :: l
5 if (allocated (a) .or. allocated (b) .or. allocated (c)) call abort
7 !$omp parallel private (a, b, c, l)
8 l = .false.
9 if (allocated (a) .or. allocated (b) .or. allocated (c)) call abort
11 !$omp single
12 allocate (a, b(6:9), c(3, 8:9))
13 a = 4
14 b = 5
15 c = 6
16 !$omp end single copyprivate (a, b, c)
18 if (.not.allocated (a)) call abort
19 if (.not.allocated (b) .or. size (b) /= 4) call abort
20 if (lbound (b, 1) /= 6 .or. ubound (b, 1) /= 9) call abort
21 if (.not.allocated (c) .or. size (c) /= 6) call abort
22 if (size (c, 1) /= 3 .or. size (c, 2) /= 2) call abort
23 if (lbound (c, 1) /= 1 .or. ubound (c, 1) /= 3) call abort
24 if (lbound (c, 2) /= 8 .or. ubound (c, 2) /= 9) call abort
25 if (a /= 4 .or. any (b /= 5) .or. any (c /= 6)) call abort
27 !$omp single
28 deallocate (a, b, c)
29 if (allocated (a) .or. allocated (b) .or. allocated (c)) call abort
30 allocate (a, b(0:4), c(3, 2:7))
31 a = 1
32 b = 2
33 c = 3
34 !$omp end single copyprivate (a, b, c)
36 if (.not.allocated (a)) call abort
37 if (.not.allocated (b) .or. size (b) /= 5) call abort
38 if (lbound (b, 1) /= 0 .or. ubound (b, 1) /= 4) call abort
39 if (.not.allocated (c) .or. size (c) /= 18) call abort
40 if (size (c, 1) /= 3 .or. size (c, 2) /= 6) call abort
41 if (lbound (c, 1) /= 1 .or. ubound (c, 1) /= 3) call abort
42 if (lbound (c, 2) /= 2 .or. ubound (c, 2) /= 7) call abort
43 if (a /= 1 .or. any (b /= 2) .or. any (c /= 3)) call abort
45 !$omp single
46 l = .true.
47 deallocate (a, b, c)
48 if (allocated (a) .or. allocated (b) .or. allocated (c)) call abort
49 allocate (a, b(2:6), c(3:5, 3:8))
50 a = 7
51 b = 8
52 c = 9
53 !$omp end single copyprivate (a, b, c)
55 if (.not.allocated (a)) call abort
56 if (.not.allocated (b) .or. size (b) /= 5) call abort
57 if (l) then
58 if (lbound (b, 1) /= 2 .or. ubound (b, 1) /= 6) call abort
59 else
60 if (lbound (b, 1) /= 0 .or. ubound (b, 1) /= 4) call abort
61 end if
62 if (.not.allocated (c) .or. size (c) /= 18) call abort
63 if (size (c, 1) /= 3 .or. size (c, 2) /= 6) call abort
64 if (l) then
65 if (lbound (c, 1) /= 3 .or. ubound (c, 1) /= 5) call abort
66 if (lbound (c, 2) /= 3 .or. ubound (c, 2) /= 8) call abort
67 else
68 if (lbound (c, 1) /= 1 .or. ubound (c, 1) /= 3) call abort
69 if (lbound (c, 2) /= 2 .or. ubound (c, 2) /= 7) call abort
70 end if
71 if (a /= 7 .or. any (b /= 8) .or. any (c /= 9)) call abort
73 !$omp end parallel
74 end