summaryrefslogtreecommitdiff
path: root/flang/test/Semantics/critical02.f90
blob: e1c9bb3e0ff103971671361f89ad6405a061bb5e (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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
! RUN: %python %S/test_errors.py %s %flang_fc1
!C1118

subroutine test1
  critical
    !ERROR: RETURN statement is not allowed in a CRITICAL construct
    return
  end critical
end subroutine test1

subroutine test2()
  implicit none
  critical
    !ERROR: An image control statement is not allowed in a CRITICAL construct
    SYNC ALL
  end critical
end subroutine test2

subroutine test3()
  use iso_fortran_env, only: team_type
  implicit none
  type(team_type) :: j
  critical
    !ERROR: An image control statement is not allowed in a CRITICAL construct
    sync team (j)
  end critical
end subroutine test3

subroutine test4()
  integer, allocatable, codimension[:] :: ca

  critical
    !ERROR: An image control statement is not allowed in a CRITICAL construct
    allocate(ca[*])
  end critical

  critical
    !ERROR: An image control statement is not allowed in a CRITICAL construct
    deallocate(ca)
  end critical
end subroutine test4

subroutine test5()
  use iso_fortran_env, only: team_type
  implicit none
  type(team_type) :: j
  critical
    change team (j)
    !ERROR: An image control statement is not allowed in a CRITICAL construct
    end team
  end critical
end subroutine test5

subroutine test6
  critical
    critical
    !ERROR: An image control statement is not allowed in a CRITICAL construct
    end critical
  end critical
end subroutine test6

subroutine test7()
  use iso_fortran_env
  type(event_type) :: x[*], y[*]
  critical
    !ERROR: An image control statement is not allowed in a CRITICAL construct
    event post (x)
    !ERROR: An image control statement is not allowed in a CRITICAL construct
    event wait (y)
  end critical
end subroutine test7

subroutine test8()
  use iso_fortran_env
  type(team_type) :: t

  critical
    !ERROR: An image control statement is not allowed in a CRITICAL construct
    form team(1, t)
  end critical
end subroutine test8

subroutine test9()
  use iso_fortran_env
  type(lock_type) :: l

  critical
    !ERROR: An image control statement is not allowed in a CRITICAL construct
    lock(l)
    !ERROR: An image control statement is not allowed in a CRITICAL construct
    unlock(l)
  end critical
end subroutine test9

subroutine test10()
  use iso_fortran_env
  integer, allocatable, codimension[:] :: ca
  allocate(ca[*])

  critical
    block
      integer, allocatable, codimension[:] :: cb
      cb = ca
    !TODO: Deallocation of this coarray is not currently caught
    end block
  end critical
end subroutine test10

subroutine test11()
  integer, allocatable, codimension[:] :: ca, cb
  critical
    !ERROR: An image control statement is not allowed in a CRITICAL construct
    call move_alloc(cb, ca)
  end critical
end subroutine test11

subroutine test12()
  critical
    !ERROR: An image control statement is not allowed in a CRITICAL construct
    stop
  end critical
end subroutine test12