aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/libgomp/testsuite/libgomp.fortran/allocatable12.f90
blob: 533ab7cd85d9debfcc5e165d5a981d395847079e (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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
! { dg-do run }

  integer, allocatable :: a, b(:), c(:,:)
  logical :: l
  if (allocated (a) .or. allocated (b) .or. allocated (c)) call abort

!$omp parallel private (a, b, c, l)
  l = .false.
  if (allocated (a) .or. allocated (b) .or. allocated (c)) call abort

!$omp single
  allocate (a, b(6:9), c(3, 8:9))
  a = 4
  b = 5
  c = 6
!$omp end single copyprivate (a, b, c)

  if (.not.allocated (a)) call abort
  if (.not.allocated (b) .or. size (b) /= 4) call abort
  if (lbound (b, 1) /= 6 .or. ubound (b, 1) /= 9) call abort
  if (.not.allocated (c) .or. size (c) /= 6) call abort
  if (size (c, 1) /= 3 .or. size (c, 2) /= 2) call abort
  if (lbound (c, 1) /= 1 .or. ubound (c, 1) /= 3) call abort
  if (lbound (c, 2) /= 8 .or. ubound (c, 2) /= 9) call abort
  if (a /= 4 .or. any (b /= 5) .or. any (c /= 6)) call abort

!$omp single
  deallocate (a, b, c)
  if (allocated (a) .or. allocated (b) .or. allocated (c)) call abort
  allocate (a, b(0:4), c(3, 2:7))
  a = 1
  b = 2
  c = 3
!$omp end single copyprivate (a, b, c)

  if (.not.allocated (a)) call abort
  if (.not.allocated (b) .or. size (b) /= 5) call abort
  if (lbound (b, 1) /= 0 .or. ubound (b, 1) /= 4) call abort
  if (.not.allocated (c) .or. size (c) /= 18) call abort
  if (size (c, 1) /= 3 .or. size (c, 2) /= 6) call abort
  if (lbound (c, 1) /= 1 .or. ubound (c, 1) /= 3) call abort
  if (lbound (c, 2) /= 2 .or. ubound (c, 2) /= 7) call abort
  if (a /= 1 .or. any (b /= 2) .or. any (c /= 3)) call abort

!$omp single
  l = .true.
  deallocate (a, b, c)
  if (allocated (a) .or. allocated (b) .or. allocated (c)) call abort
  allocate (a, b(2:6), c(3:5, 3:8))
  a = 7
  b = 8
  c = 9
!$omp end single copyprivate (a, b, c)

  if (.not.allocated (a)) call abort
  if (.not.allocated (b) .or. size (b) /= 5) call abort
  if (l) then
    if (lbound (b, 1) /= 2 .or. ubound (b, 1) /= 6) call abort
  else
    if (lbound (b, 1) /= 0 .or. ubound (b, 1) /= 4) call abort
  end if
  if (.not.allocated (c) .or. size (c) /= 18) call abort
  if (size (c, 1) /= 3 .or. size (c, 2) /= 6) call abort
  if (l) then
    if (lbound (c, 1) /= 3 .or. ubound (c, 1) /= 5) call abort
    if (lbound (c, 2) /= 3 .or. ubound (c, 2) /= 8) call abort
  else
    if (lbound (c, 1) /= 1 .or. ubound (c, 1) /= 3) call abort
    if (lbound (c, 2) /= 2 .or. ubound (c, 2) /= 7) call abort
  end if
  if (a /= 7 .or. any (b /= 8) .or. any (c /= 9)) call abort

!$omp end parallel
end