aboutsummaryrefslogtreecommitdiff
blob: 80aad3c26157890ff868805c6a7784347f773433 (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
! RUN: %S/test_errors.sh %s %t %flang_fc1
! Tests for C1128:
! A variable-name that appears in a LOCAL or LOCAL_INIT locality-spec shall not
! have the ALLOCATABLE; INTENT (IN); or OPTIONAL attribute; shall not be of
! finalizable type; shall not be a nonpointer polymorphic dummy argument; and
! shall not be a coarray or an assumed-size array.

subroutine s1()
! Cannot have ALLOCATABLE variable in a locality spec
  integer, allocatable :: k
!ERROR: ALLOCATABLE variable 'k' not allowed in a locality-spec
  do concurrent(i=1:5) local(k)
  end do
end subroutine s1

subroutine s2(arg)
! Cannot have a dummy OPTIONAL in a locality spec
  integer, optional :: arg
!ERROR: OPTIONAL argument 'arg' not allowed in a locality-spec
  do concurrent(i=1:5) local(arg)
  end do
end subroutine s2

subroutine s3(arg)
! This is OK
  real :: arg
  do concurrent(i=1:5) local(arg)
  end do
end subroutine s3

subroutine s4(arg)
! Cannot have a dummy INTENT(IN) in a locality spec
  real, intent(in) :: arg
!ERROR: INTENT IN argument 'arg' not allowed in a locality-spec
  do concurrent(i=1:5) local(arg)
  end do
end subroutine s4

module m
! Cannot have a variable of a finalizable type in a locality spec
  type t1
    integer :: i
  contains
    final :: f
  end type t1
 contains
  subroutine s5()
    type(t1) :: var
    !ERROR: Finalizable variable 'var' not allowed in a locality-spec
    do concurrent(i=1:5) local(var)
    end do
  end subroutine s5
  subroutine f(x)
    type(t1) :: x
  end subroutine f
end module m

subroutine s6
! Cannot have a nonpointer polymorphic dummy argument in a locality spec
  type :: t
    integer :: field
  end type t
contains
  subroutine s(x, y)
    class(t), pointer :: x
    class(t) :: y

! This is allowed
    do concurrent(i=1:5) local(x)
    end do

! This is not allowed
!ERROR: Nonpointer polymorphic argument 'y' not allowed in a locality-spec
    do concurrent(i=1:5) local(y)
    end do
  end subroutine s
end subroutine s6

subroutine s7()
! Cannot have a coarray
  integer, codimension[*] :: coarray_var
!ERROR: Coarray 'coarray_var' not allowed in a locality-spec
  do concurrent(i=1:5) local(coarray_var)
  end do
end subroutine s7

subroutine s8(arg)
! Cannot have an assumed size array
  integer, dimension(*) :: arg
!ERROR: Assumed size array 'arg' not allowed in a locality-spec
  do concurrent(i=1:5) local(arg)
  end do
end subroutine s8