Fix warning with -Wsign-compare -Wsystem-headers
[official-gcc.git] / libgomp / testsuite / libgomp.oacc-fortran / pset-1.f90
blobc3a8a9cac1cd672c75b8bbf18088f3eabeb8f66b
1 ! { dg-do run }
3 program test
4 implicit none
5 integer, allocatable :: a1(:)
6 integer, allocatable :: b1(:)
7 integer, allocatable :: c1(:)
8 integer, allocatable :: b2(:,:)
9 integer, allocatable :: c3(:,:,:)
11 allocate (a1(5))
12 if (.not.allocated (a1)) STOP 1
14 a1 = 10
16 !$acc parallel copy(a1(1:5))
17 a1(1) = 1
18 a1(2) = 2
19 a1(3) = 3
20 a1(4) = 4
21 a1(5) = 5
22 !$acc end parallel
24 if (a1(1) .ne. 1) STOP 1
25 if (a1(2) .ne. 2) STOP 2
26 if (a1(3) .ne. 3) STOP 3
27 if (a1(4) .ne. 4) STOP 4
28 if (a1(5) .ne. 5) STOP 5
30 deallocate(a1)
32 allocate (a1(0:4))
33 if (.not.allocated (a1)) STOP 2
35 a1 = 10
37 !$acc parallel copy(a1(0:4))
38 a1(0) = 1
39 a1(1) = 2
40 a1(2) = 3
41 a1(3) = 4
42 a1(4) = 5
43 !$acc end parallel
45 if (a1(0) .ne. 1) STOP 6
46 if (a1(1) .ne. 2) STOP 7
47 if (a1(2) .ne. 3) STOP 8
48 if (a1(3) .ne. 4) STOP 9
49 if (a1(4) .ne. 5) STOP 10
51 deallocate(a1)
53 allocate (b2(5,5))
54 if (.not.allocated (b2)) STOP 3
56 b2 = 11
58 !$acc parallel copy(b2(1:5,1:5))
59 b2(1,1) = 1
60 b2(2,2) = 2
61 b2(3,3) = 3
62 b2(4,4) = 4
63 b2(5,5) = 5
64 !$acc end parallel
66 if (b2(1,1) .ne. 1) STOP 11
67 if (b2(2,2) .ne. 2) STOP 12
68 if (b2(3,3) .ne. 3) STOP 13
69 if (b2(4,4) .ne. 4) STOP 14
70 if (b2(5,5) .ne. 5) STOP 15
72 deallocate(b2)
74 allocate (b2(0:4,0:4))
75 if (.not.allocated (b2)) STOP 4
77 b2 = 11
79 !$acc parallel copy(b2(0:4,0:4))
80 b2(0,0) = 1
81 b2(1,1) = 2
82 b2(2,2) = 3
83 b2(3,3) = 4
84 b2(4,4) = 5
85 !$acc end parallel
87 if (b2(0,0) .ne. 1) STOP 16
88 if (b2(1,1) .ne. 2) STOP 17
89 if (b2(2,2) .ne. 3) STOP 18
90 if (b2(3,3) .ne. 4) STOP 19
91 if (b2(4,4) .ne. 5) STOP 20
93 deallocate(b2)
95 allocate (c3(5,5,5))
96 if (.not.allocated (c3)) STOP 5
98 c3 = 12
100 !$acc parallel copy(c3(1:5,1:5,1:5))
101 c3(1,1,1) = 1
102 c3(2,2,2) = 2
103 c3(3,3,3) = 3
104 c3(4,4,4) = 4
105 c3(5,5,5) = 5
106 !$acc end parallel
108 if (c3(1,1,1) .ne. 1) STOP 21
109 if (c3(2,2,2) .ne. 2) STOP 22
110 if (c3(3,3,3) .ne. 3) STOP 23
111 if (c3(4,4,4) .ne. 4) STOP 24
112 if (c3(5,5,5) .ne. 5) STOP 25
114 deallocate(c3)
116 allocate (c3(0:4,0:4,0:4))
117 if (.not.allocated (c3)) STOP 6
119 c3 = 12
121 !$acc parallel copy(c3(0:4,0:4,0:4))
122 c3(0,0,0) = 1
123 c3(1,1,1) = 2
124 c3(2,2,2) = 3
125 c3(3,3,3) = 4
126 c3(4,4,4) = 5
127 !$acc end parallel
129 if (c3(0,0,0) .ne. 1) STOP 26
130 if (c3(1,1,1) .ne. 2) STOP 27
131 if (c3(2,2,2) .ne. 3) STOP 28
132 if (c3(3,3,3) .ne. 4) STOP 29
133 if (c3(4,4,4) .ne. 5) STOP 30
135 deallocate(c3)
137 allocate (a1(5))
138 if (.not.allocated (a1)) STOP 7
140 allocate (b1(5))
141 if (.not.allocated (b1)) STOP 8
143 allocate (c1(5))
144 if (.not.allocated (c1)) STOP 9
146 a1 = 10
147 b1 = 3
148 c1 = 7
150 !$acc parallel copyin(a1(1:5)) create(c1(1:5)) copyout(b1(1:5))
151 c1(1) = a1(1)
152 c1(2) = a1(2)
153 c1(3) = a1(3)
154 c1(4) = a1(4)
155 c1(5) = a1(5)
157 b1(1) = c1(1)
158 b1(2) = c1(2)
159 b1(3) = c1(3)
160 b1(4) = c1(4)
161 b1(5) = c1(5)
162 !$acc end parallel
164 if (b1(1) .ne. 10) STOP 31
165 if (b1(2) .ne. 10) STOP 32
166 if (b1(3) .ne. 10) STOP 33
167 if (b1(4) .ne. 10) STOP 34
168 if (b1(5) .ne. 10) STOP 35
170 deallocate(a1)
171 deallocate(b1)
172 deallocate(c1)
174 allocate (a1(0:4))
175 if (.not.allocated (a1)) STOP 10
177 allocate (b1(0:4))
178 if (.not.allocated (b1)) STOP 11
180 allocate (c1(0:4))
181 if (.not.allocated (c1)) STOP 12
183 a1 = 10
184 b1 = 3
185 c1 = 7
187 !$acc parallel copyin(a1(0:4)) create(c1(0:4)) copyout(b1(0:4))
188 c1(0) = a1(0)
189 c1(1) = a1(1)
190 c1(2) = a1(2)
191 c1(3) = a1(3)
192 c1(4) = a1(4)
194 b1(0) = c1(0)
195 b1(1) = c1(1)
196 b1(2) = c1(2)
197 b1(3) = c1(3)
198 b1(4) = c1(4)
199 !$acc end parallel
201 if (b1(0) .ne. 10) STOP 36
202 if (b1(1) .ne. 10) STOP 37
203 if (b1(2) .ne. 10) STOP 38
204 if (b1(3) .ne. 10) STOP 39
205 if (b1(4) .ne. 10) STOP 40
207 deallocate(a1)
208 deallocate(b1)
209 deallocate(c1)
211 allocate (a1(5))
212 if (.not.allocated (a1)) STOP 13
214 a1 = 10
216 !$acc parallel copy(a1(2:3))
217 a1(2) = 2
218 a1(3) = 3
219 !$acc end parallel
221 if (a1(1) .ne. 10) STOP 41
222 if (a1(2) .ne. 2) STOP 42
223 if (a1(3) .ne. 3) STOP 43
224 if (a1(4) .ne. 10) STOP 44
225 if (a1(5) .ne. 10) STOP 45
227 deallocate(a1)
229 end program test