Debian Codegraph @

gcc/testsuite/gfortran.dg/do_concurrent_constraints.f90

raw
1 ! { dg-do compile }
2 ! { dg-options "-fcoarray=single" }
3
4 module m
5 type t1
6 integer, allocatable :: x
7 end type t1
8
9 type t2
10 type(t1), allocatable :: y
11 end type t2
12
13 type, abstract :: abstract_type
14 end type abstract_type
15
16 contains
17 subroutine test_c1130(a, b, c, d, e, f, g, h, j)
18 integer, allocatable :: a
19 integer, intent(in) :: b
20 integer, optional :: c
21 type(t1) :: d
22 real :: e[*]
23 integer :: f(*)
24 type(t2) :: g
25 class(abstract_type), pointer :: h
26 class(abstract_type) :: j
27 integer :: i
28
29 ! C1130 tests
30 do concurrent (i=1:5) local(a) ! { dg-error "ALLOCATABLE attribute not permitted for 'a' in LOCAL locality-spec" }
31 end do
32 do concurrent (i=1:5) local(b) ! { dg-error "Dummy argument 'b' with INTENT\\(IN\\) in variable definition context \\(LOCAL\\) at" }
33 end do
34 do concurrent (i=1:5) local(c) ! { dg-error "OPTIONAL attribute not permitted for 'c' in LOCAL locality-spec" }
35 end do
36 do concurrent (i=1:5) local(d) ! { dg-error "Type with ultimate allocatable component not permitted for 'd' in LOCAL locality-spec" }
37 end do
38 do concurrent (i=1:5) local(e) ! { dg-error "Expected variable name in LOCAL locality spec" }
39 end do
40 do concurrent (i=1:5) local(f) ! { dg-error "The upper bound in the last dimension must appear in the reference to the assumed size array 'f'" }
41 end do
42 do concurrent (i=1:5) local(g) ! { dg-error "Type with ultimate allocatable component not permitted for 'g' in LOCAL locality-spec" }
43 end do
44 do concurrent (i=1:5) local(h)
45 end do
46 do concurrent (i=1:5) local(j) ! { dg-error "Nonpointer polymorphic dummy argument not permitted for 'j' in LOCAL locality-spec" }
47 end do
48
49 ! LOCAL_INIT tests
50 do concurrent (i=1:5) local_init(a) ! { dg-error "ALLOCATABLE attribute not permitted for 'a' in LOCAL_INIT locality-spec" }
51 end do
52 do concurrent (i=1:5) local_init(b) ! { dg-error "Dummy argument 'b' with INTENT\\(IN\\) in variable definition context \\(LOCAL_INIT\\) at" }
53 end do
54 do concurrent (i=1:5) local_init(c) ! { dg-error "OPTIONAL attribute not permitted for 'c' in LOCAL_INIT locality-spec" }
55 end do
56 do concurrent (i=1:5) local_init(d) ! { dg-error "Type with ultimate allocatable component not permitted for 'd' in LOCAL_INIT locality-spec" }
57 end do
58 do concurrent (i=1:5) local_init(e) ! { dg-error "Expected variable name in LOCAL_INIT locality spec" }
59 end do
60 do concurrent (i=1:5) local_init(f) ! { dg-error "The upper bound in the last dimension must appear in the reference to the assumed size array 'f'" }
61 end do
62 do concurrent (i=1:5) local_init(g) ! { dg-error "Type with ultimate allocatable component not permitted for 'g' in LOCAL_INIT locality-spec" }
63 end do
64 do concurrent (i=1:5) local_init(h)
65 end do
66 do concurrent (i=1:5) local_init(j) ! { dg-error "Nonpointer polymorphic dummy argument not permitted for 'j' in LOCAL_INIT locality-spec" }
67 end do
68 end subroutine test_c1130
69
70 subroutine test_c1131(a, b, c, d, e, f, g)
71 integer, asynchronous :: a
72 integer, intent(in) :: b
73 integer, optional :: c
74 integer, volatile :: d
75 real :: e[*]
76 integer :: f(*)
77 real :: g(3)[*]
78 integer :: i
79
80 ! C1131 tests
81 do concurrent (i=1:5) reduce(+:a) ! { dg-error "ASYNCHRONOUS attribute not permitted for 'a' in REDUCE locality-spec" }
82 end do
83 do concurrent (i=1:5) reduce(+:b)
84 ! { dg-error "Dummy argument 'b' with INTENT\\(IN\\) in variable definition context \\(REDUCE\\)" "" { target *-*-* } .-1 }
85 end do
86 do concurrent (i=1:5) reduce(+:c) ! { dg-error "OPTIONAL attribute not permitted for 'c' in REDUCE locality-spec" }
87 end do
88 do concurrent (i=1:5) reduce(+:d) ! { dg-error "VOLATILE attribute not permitted for 'd' in REDUCE locality-spec" }
89 end do
90 do concurrent (i=1:5) reduce(+:e) ! { dg-error "Expected variable name in REDUCE locality spec" }
91 end do
92 do concurrent (i=1:5) reduce(+:f) ! { dg-error "The upper bound in the last dimension must appear in the reference to the assumed size array 'f'" }
93 end do
94 do concurrent (i=1:5) reduce(+:g(2)[1]) ! { dg-error "Expected variable name in REDUCE locality spec" }
95 end do
96 end subroutine test_c1131
97
98 subroutine test_c1132()
99 logical :: l1, l2, l3, l4
100 integer :: i, int1
101 real :: r1
102 complex :: c1, c2, c3
103 character(len=10) :: str1, str2, str3, str4
104
105 ! C1132 tests
106 do concurrent (i=1:5) &
107 reduce(+:l1) & ! { dg-error "Expected numeric type for 'l1' in REDUCE at \\(1\\), got LOGICAL" }
108 reduce(*:l2) & ! { dg-error "Expected numeric type for 'l2' in REDUCE at \\(1\\), got LOGICAL" }
109 reduce(max:l3) & ! { dg-error "Expected INTEGER, REAL or CHARACTER type for 'l3' in REDUCE with MIN/MAX at \\(1\\), got LOGICAL" }
110 reduce(iand:l4) ! { dg-error "Expected integer type for 'l4' in REDUCE with IAND/IOR/IEOR at \\(1\\), got LOGICAL" }
111 end do
112
113 do concurrent (i=1:5) &
114 reduce(*:str2) & ! { dg-error "Expected numeric type for 'str2' in REDUCE at \\(1\\), got CHARACTER" }
115 reduce(min:str3) & ! OK
116 reduce(max:str4) ! OK
117 end do
118
119 do concurrent (i=1:5) &
120 reduce(*:c2) & ! OK
121 reduce(max:c3) ! { dg-error "Expected INTEGER, REAL or CHARACTER type for 'c3' in REDUCE with MIN/MAX at \\(1\\), got COMPLEX" }
122 end do
123
124 end subroutine test_c1132
125
126 end module m