| 1 |
! { dg-do run } |
| 2 |
|
| 3 |
integer, allocatable :: a, b(:), c(:,:) |
| 4 |
logical :: l |
| 5 |
if (allocated (a) .or. allocated (b) .or. allocated (c)) stop 1 |
| 6 |
|
| 7 |
!$omp parallel private (a, b, c, l) |
| 8 |
l = .false. |
| 9 |
if (allocated (a) .or. allocated (b) .or. allocated (c)) stop 2 |
| 10 |
|
| 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) |
| 17 |
|
| 18 |
if (.not.allocated (a)) stop 3 |
| 19 |
if (.not.allocated (b) .or. size (b) /= 4) stop 4 |
| 20 |
if (lbound (b, 1) /= 6 .or. ubound (b, 1) /= 9) stop 5 |
| 21 |
if (.not.allocated (c) .or. size (c) /= 6) stop 6 |
| 22 |
if (size (c, 1) /= 3 .or. size (c, 2) /= 2) stop 7 |
| 23 |
if (lbound (c, 1) /= 1 .or. ubound (c, 1) /= 3) stop 8 |
| 24 |
if (lbound (c, 2) /= 8 .or. ubound (c, 2) /= 9) stop 9 |
| 25 |
if (a /= 4 .or. any (b /= 5) .or. any (c /= 6)) stop 10 |
| 26 |
|
| 27 |
!$omp single |
| 28 |
deallocate (a, b, c) |
| 29 |
if (allocated (a) .or. allocated (b) .or. allocated (c)) stop 11 |
| 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) |
| 35 |
|
| 36 |
if (.not.allocated (a)) stop 12 |
| 37 |
if (.not.allocated (b) .or. size (b) /= 5) stop 13 |
| 38 |
if (lbound (b, 1) /= 0 .or. ubound (b, 1) /= 4) stop 14 |
| 39 |
if (.not.allocated (c) .or. size (c) /= 18) stop 15 |
| 40 |
if (size (c, 1) /= 3 .or. size (c, 2) /= 6) stop 16 |
| 41 |
if (lbound (c, 1) /= 1 .or. ubound (c, 1) /= 3) stop 17 |
| 42 |
if (lbound (c, 2) /= 2 .or. ubound (c, 2) /= 7) stop 18 |
| 43 |
if (a /= 1 .or. any (b /= 2) .or. any (c /= 3)) stop 19 |
| 44 |
|
| 45 |
!$omp single |
| 46 |
l = .true. |
| 47 |
deallocate (a, b, c) |
| 48 |
if (allocated (a) .or. allocated (b) .or. allocated (c)) stop 20 |
| 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) |
| 54 |
|
| 55 |
if (.not.allocated (a)) stop 21 |
| 56 |
if (.not.allocated (b) .or. size (b) /= 5) stop 22 |
| 57 |
if (l) then |
| 58 |
if (lbound (b, 1) /= 2 .or. ubound (b, 1) /= 6) stop 23 |
| 59 |
else |
| 60 |
if (lbound (b, 1) /= 0 .or. ubound (b, 1) /= 4) stop 24 |
| 61 |
end if |
| 62 |
if (.not.allocated (c) .or. size (c) /= 18) stop 25 |
| 63 |
if (size (c, 1) /= 3 .or. size (c, 2) /= 6) stop 26 |
| 64 |
if (l) then |
| 65 |
if (lbound (c, 1) /= 3 .or. ubound (c, 1) /= 5) stop 27 |
| 66 |
if (lbound (c, 2) /= 3 .or. ubound (c, 2) /= 8) stop 28 |
| 67 |
else |
| 68 |
if (lbound (c, 1) /= 1 .or. ubound (c, 1) /= 3) stop 29 |
| 69 |
if (lbound (c, 2) /= 2 .or. ubound (c, 2) /= 7) stop 30 |
| 70 |
end if |
| 71 |
if (a /= 7 .or. any (b /= 8) .or. any (c /= 9)) stop 31 |
| 72 |
|
| 73 |
!$omp end parallel |
| 74 |
end |