File: allocatable12.f90

package info (click to toggle)
gcc-avr 1%3A5.4.0%2BAtmel3.6.2-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 589,884 kB
  • sloc: ansic: 2,775,581; ada: 756,757; cpp: 723,977; f90: 117,673; asm: 66,897; makefile: 62,756; xml: 44,466; sh: 29,549; exp: 23,315; objc: 15,216; fortran: 10,901; pascal: 4,185; python: 4,093; perl: 2,969; awk: 2,811; ml: 2,385; cs: 879; yacc: 316; lex: 198; haskell: 112; lisp: 8
file content (74 lines) | stat: -rw-r--r-- 2,433 bytes parent folder | download | duplicates (3)
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